Created
November 13, 2014 10:12
-
-
Save JubbaSmail/2830c65d24c767e9de82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <windows.h> | |
| #include <stdio.h> | |
| #if define UNICODE | |
| #define SetCurrentDirectory SetCurrentDirectoryW | |
| #define GetCurrentDirectory GetCurrentDirectoryW | |
| #else | |
| #define SetCurrentDirectory SetCurrentDirectoryA | |
| #define GetCurrentDirectory GetCurrentDirectoryA | |
| #endif | |
| int main(int argc, LPTSTR argv[]) | |
| { | |
| if (argc != 2) { | |
| fprintf(stderr, "Usage: mycd dirName\n"); | |
| return 1; | |
| } | |
| SetCurrentDirectory(argv[1]); | |
| CHAR pwdBuffer[MAX_PATH]; | |
| DWORD x = GetCurrentDirectory(MAX_PATH, pwdBuffer); | |
| printf(pwdBuffer); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment