如何得到本程序的路径?vb中有app.path,vc中有对应的语句吗?

解决方案 »

  1.   

    The GetCurrentDirectory function retrieves the current directory for the current process
    DWORD GetCurrentDirectory(
      DWORD nBufferLength,  // size of directory buffer
      LPTSTR lpBuffer       // directory buffer
    );
      

  2.   

    char FileName[256];
    void GetCurrentDir(void)
    {
    char *pTemp;
    strcpy(FileName,Application->ExeName.c_str());
    pTemp=FileName;
    while(*pTemp)pTemp++; //移pTemp到字符串尾部
    while(*pTemp!=\\)*pTemp--;
    *PTemp=0;
    }
      

  3.   

    int len=0;
    char path[1024]={0};
    ::GetCurrentDirectory(len,path);***********************************************The GetCurrentDirectory function retrieves the current directory for the current process. DWORD GetCurrentDirectory(
      DWORD nBufferLength,  // size of directory buffer
      LPTSTR lpBuffer       // directory buffer
    );
      

  4.   

    楼上说得不错,就是GetCurrentDirectory
      

  5.   

    GetCurrentDirectory wrongGetModuleFileName
    去掉 appname
      

  6.   

    GetCurrentDirectory()得到当前目录.
    GetSystemDirectory()得到系统目录.
    GetWindowsDirectory()得到windows的安装目录.