Guest User

OS lab 2

a guest
Jul 20th, 2015
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. lab3 : implementing ls command
  2.  
  3.  
  4. system calls:
  5.  
  6. -mkdir
  7. -opendir
  8. -readdir
  9. -rmdir
  10. -closedir
  11. -getcwd
  12.  
  13.  
  14. aim: print pwd
  15.  
  16. pwd.c
  17.  
  18. #include<stdio.h>
  19. #include<stdlib.h>
  20. #include<unistd.h>
  21. #define BUFF 1024
  22.  
  23. int main()
  24. {
  25. char buf[BUFF];
  26.  
  27. if(getcwd(buf,sizeof(buf))!=NULL)
  28. {
  29. printf("%s\n",buf);
  30. }
  31. else
  32. {
  33. printf("Error.");
  34. }
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment