#include <wchar.h>
|
int
wchdir (const wchar_t *path);
|
#include<wchar.h> /* wmkdir, wrmdir */ #include <sys/stat.h> /* S_IRWXU */ #include <stdio.h> /* printf */ int main() { int ret_wmkdir = wmkdir(L"dirName", S_IRWXU); /* create directory */ if(ret_wmkdir < 0) { printf("error creating directory"); return -1; } else { int ret_wchdir = wchdir(L"dirName"); /* change directory */ if(ret_wchdir < 0) { printf("error changing directory"); return -1; } else { printf("working directory changed"); } wrmdir(L"dirname"); /* remove directory */ } return 0; }
Output
working directory changed
[ENOTDIR] | |
Not a directory. | |
[ENAMETOOLONG] | |
A component of a pathname exceeded 255 characters. | |
[ENOENT] | |
The named file does not exist. | |
[EINVAL] | |
Invalid argument. | |
© 2005-2007 Nokia |