如c:\aa\bb\cc
当c:\aa不存在时,如何创建bb及cc?用什么函数?我用CreateDirectory("c:\\aa\\bb\\cc",NULL); 创建子目录失败
当c:\aa不存在时,如何创建bb及cc?用什么函数?我用CreateDirectory("c:\\aa\\bb\\cc",NULL); 创建子目录失败
解决方案 »
- 有关MFC中MENU的问题
- MessageBox的返回值是什么,怎么获得它的返回值呢?
- TCP select为什么没数据接受了 他为什么不停返回1,可读啊
- 救命啊!!!数据库开发高手请救命!!!
- 奇怪了,CDateTimeCtrl的成员列表不正确,大伙进来看看!
- 求《idl精髓》电子书
- 我想把一个文件载入内存,然后给出一个地址,让其它程序(如记事本)用这个地址打开内存中的文件
- 请高手确诊: 为什么我的内存在不断的丢失???
- 150请教高人,一个取CLISTCTRL项目的问题??,急急急!!!!!!!!!
- 怎样用MFC的类CAsyncSocket作服务器程序同时对多个客户端程序发信息
- 如何在指定Buffer中查找特定字符串??
- 一个关于COM的问题!!!!!!!!!!!!!!!!!!!!!!大侠帮忙
BOOL CreateDirectoryEx(
LPCTSTR lpTemplateDirectory, // pointer to template directory path
LPCTSTR lpNewDirectory, // pointer to path of directory to create
LPSECURITY_ATTRIBUTES lpSecurityAttributes // pointer to security descriptor
);
MakeSureDirectoryPathExists
The MakeSureDirectoryPathExists function creates all the directories in the specified DirPath, beginning with the root.BOOL MakeSureDirectoryPathExists(
PCSTR DirPath
);
Parameters
DirPath
[in] Pointer to a null-terminated string that specifies a valid path name. If the final component of the path is a directory, not a file name, the string must end with a backslash (\) character.
Return Values
If the function succeeds, the return value is TRUE.If the function fails, the return value is FALSE. To retrieve extended error information, call GetLastError.Res
Each directory specified is created, if it does not already exist. If only some of the directories are created, the function will return FALSE.All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Redistributable: Requires DbgHelp.dll 5.0 or later on Windows NT 4.0 and Windows 95/98/Me.
Header: Declared in Dbghelp.h.
Library: Use Dbghelp.lib.See Also
Debug Help Library Overview, DbgHelp Functions Platform SDK Release: August 2001 What did you think of this topic?
Let us know. Order a Platform SDK CD Online
(U.S/Canada) (International)
再包含上头文件imagehlp.h就可以了。
Version 5.00 and later of Shell32.dll Windows NT/2000: Requires Windows 2000.
Header: Declared in shlobj.h.
Import Library: shell32.lib.
再包含上头文件imagehlp.h就可以了。
{
char *pdest;
int result;
char tmpstr[100]="\0";
pdest = strstr( DestChar, FindChar );
result = pdest - DestChar + 1;
int tmprs=result;
if (pdest!=NULL)
{
pdest = strstr( &DestChar[result], FindChar );
result=pdest-DestChar + 1;
}
while(result>tmprs)
{
strncpy(tmpstr,DestChar,result-1);
CreateDirectory(tmpstr,NULL);
pdest = strstr( &DestChar[result], FindChar );
result=pdest-DestChar + 1;
}
CreateDirectory(DestChar,NULL);
}
HELLO.EXE
IMAGEHLP.DLL
KERNEL32.DLL
MFC42.DLL
MSVCRT.DLL
NTDLL.DLL
USER32.DLL你可以用dependency walker看一看,上面是需要的,如果你有vc的运行环境,肯定是可以的了,不过保险起见,还是一块编译进去比较好。