1 #include <stdio.h> 2 3 #ifdef _MSC_VER 4 #define _CRT_NONSTDC_NO_WARNINGS 5 #include <direct.h> 6 #undef getcwd 7 #define getcwd(buffer, length) _getcwd(buffer, length) 8 #else 9 #include <unistd.h> 10 #endif 11 12 int main(int argc,char ** argv)13main (int argc, char **argv) 14 { 15 char buffer[1024]; 16 17 fprintf(stdout, "stdout: %s\n", getcwd(buffer, 1024)); 18 fprintf(stderr, "stderr: %s\n", getcwd(buffer, 1024)); 19 20 return 0; 21 } 22