fork download
  1. #include <unistd.h>
  2. #include <stdio.h>
  3. #include <errno.h>
  4.  
  5. int main() {
  6. char cwd[1024];
  7. if (getcwd(cwd, sizeof(cwd)) != NULL)
  8. fprintf(stdout, "Current working dir: %s\n", cwd);
  9. else
  10. perror("getcwd() error");
  11. return 0;
  12. }
Success #stdin #stdout 0s 2112KB
stdin
Standard input is empty
stdout
Current working dir: /home/7w2Pr8