1.创建目录
BOOL WINAPI CreateDirectory( __in_opt LPCTSTR lpPathName, __in LPSECURITY_ATTRIBUTES lpSecurityAttributes );
2.删除目录
BOOL WINAPI RemoveDirectory( __in LPCTSTR lpPathName );
3.获取当前目录
DWORD WINAPI GetCurrentDirectory( __in DWORD nBufferLength, __out LPTSTR lpBuffer );
4.设置当前目录
BOOL WINAPI SetCurrentDirectory( __in LPCTSTR lpPathName );
Test
#include <windows.h> #include <stdio.h> int main() { std::wstring strDir(L"d:\\test\\testDir"); CreateDirectory(strDir.c_str(),NULL); TCHAR szCurrentDirectory[MAX_PATH]; DWORD length= GetCurrentDirectory(MAX_PATH,szCurrentDirectory); SetCurrentDirectory(strDir.c_str()); GetCurrentDirectory(MAX_PATH,szCurrentDirectory); RemoveDirectory(strDir.c_str()); }