how to distinguish a file and a directory
hi
I need to know how to distinguish between a file and a directory in a C program, under Linux and Windows. Is there any system calls to check if it is a directory? regards, joe. |
Try and open it using opendir:
Code:
#include <sys/types.h> |
You can check the file type (regular file, dir, pipe, device, etc.) with stat() (see "man 2 stat").
Example: Code:
#include <stdio.h> |
All times are GMT -5. The time now is 08:59 AM. |