Advertisement
metalx1000

Get Current Directory PWD

Jan 31st, 2016
664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.20 KB | None | 0 0
  1. #include <unistd.h>
  2. #include <stdio.h>
  3.  
  4. int main() {
  5.     char cwd[1024];
  6.     chdir("/path/to/change/directory/to");
  7.     getcwd(cwd, sizeof(cwd));
  8.     printf("Current working dir: %s\n", cwd);
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement