Guest User

Untitled

a guest
Mar 30th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <fcntl.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <sys/stat.h>
  5. #include <sys/types.h>
  6. #include <unistd.h>
  7.  
  8. int main(int argc, char **argv) {
  9.     char* path = "/tmp32";
  10.  
  11.     struct stat st;
  12.     lstat(path, &st);
  13.     if (S_ISDIR(st.st_mode)) {
  14.         printf("Given path is a directory!\n");
  15.     }
  16.     else {
  17.         printf("Given path is not a directory!\n");
  18.     }
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment