Results 1 to 3 of 3
Are there some convenient ways to judge a filename is a file or directory in standard C.
I have an unhandy way is using fopen to test the filename. if ...
- 11-05-2008 #1Just Joined!
- Join Date
- Nov 2008
- Posts
- 2
file or directory?
Are there some convenient ways to judge a filename is a file or directory in standard C.
I have an unhandy way is using fopen to test the filename. if fopen succeeds, it's a file, otherwise it's a directory.
any help will be deeply appreciated!
- 11-05-2008 #2
Yes.Use stat() and then determine the file type.
Check this link :
File Attributes - The GNU C Library- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 11-05-2008 #3Just Joined!
- Join Date
- Nov 2008
- Posts
- 2


Reply With Quote
