Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <direct.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <errno.h>
- /*
- compile with
- g++ test_chdir.cpp -o test_chdir.exe
- */
- void verbose_chdir(const char* path){
- const int err = _chdir(path);
- printf("chdir %s\n", path);
- if (err == 0)
- return;
- switch (errno) {
- case ENOENT:
- printf( "Unable to locate the directory: %s\n", path );
- break;
- case EINVAL:
- printf( "Invalid buffer.\n");
- break;
- default:
- printf( "Unknown error.\n");
- }
- }
- int main(int argc, char**argv){
- verbose_chdir("C:\\Reactos\\");
- verbose_chdir("C:\\Reactos\\");
- verbose_chdir("C:\\Reactos");
- verbose_chdir("C:\\Reactos");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement