请教当前工程目录路径问题...
vb中可以用app.path代表当前的工程目录,vc中是否有类似app这样的类?要得到当前工程所在的目录该怎么办? 问题点数:20、回复次数:4Top
1 楼syy64(太平洋)回复于 2006-03-03 11:30:59 得分 5
GetCurrentDirectory
The GetCurrentDirectory function retrieves the current directory for the current process.
DWORD GetCurrentDirectory(
DWORD nBufferLength, // size, in characters, of directory buffer
LPTSTR lpBuffer // pointer to buffer for current directory
);
Top
2 楼BombZhang(我当大哥很久了)回复于 2006-03-03 11:53:27 得分 5
void GetProjectDir(char strDir[MAX_FULLPATHNAME_LEN])
{
char strSystemDir[MAX_PATH];
memset(strSystemDir, 0, MAX_PATH);
GetModuleFileName(NULL,strSystemDir,MAX_PATH);
CString tempstring=strSystemDir;
tempstring=tempstring.Left(tempstring.ReverseFind('\\'));
strcpy(strDir,tempstring.GetBuffer(tempstring.GetLength()));
}Top
3 楼js_gary(李祥)回复于 2006-03-03 12:38:40 得分 5
GetCurrentDirectory
The GetCurrentDirectory function retrieves the current directory for the current process.
DWORD GetCurrentDirectory(
DWORD nBufferLength, // size of directory buffer
LPTSTR lpBuffer // directory buffer
);
Parameters
nBufferLength
[in] Specifies the length, in TCHARs, of the buffer for the current directory string. The buffer length must include room for a terminating null character.
lpBuffer
[out] Pointer to the buffer that receives the current directory string. This null-terminated string specifies the absolute path to the current directory.
Return Values
If the function succeeds, the return value specifies the number of characters written to the buffer, not including the terminating null character.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the buffer pointed to by lpBuffer is not large enough, the return value specifies the required size of the buffer, including the number of bytes necessary for a terminating null character.
Top
4 楼gflpower(燕赤侠)回复于 2006-03-03 12:46:10 得分 5
BombZhang(Love our country != Love the party) ( ) 信
正解
Top




