Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fcntl.h>
- #include <stdio.h>
- #include <string.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <unistd.h>
- int main(int argc, char **argv) {
- char* path = "/tmp32";
- struct stat st;
- lstat(path, &st);
- if (S_ISDIR(st.st_mode)) {
- printf("Given path is a directory!\n");
- }
- else {
- printf("Given path is not a directory!\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment