1 #include <stdio.h> 2 3 #if defined(_WIN32) 4 #include <direct.h> 5 #define getcwd _getcwd 6 #else 7 #include <unistd.h> 8 #endif 9 main()10int main() 11 { 12 char working_directory[8096]; 13 14 if (getcwd(working_directory, sizeof(working_directory)) == NULL) { 15 return 1; 16 } 17 18 printf("%s", working_directory); 19 20 return 0; 21 } 22