file types
Hi Everyone!
I am working on a c program which displays all the directories and files under each directory. I want to know what kind of file each is. Like, is the file an ascii text file or english text or a c file. if it is an executable, is it an binary file or a shell script. I was told to look inside the file to achieve this.How should I do this.Man pages are difficult to understand and quite confusing.Any help is appreciated. Thanks in advance. |
check out the functionality from the standard libmagic http://www.die.net/doc/linux/man/man3/libmagic.3.html
|
Thankyou,acid_kewpie!
|
Hi acid_kewpie!
Can u give me an example of how to read a file for bytes and then decide what it is.I am all confused. Like, stat returned and says it is a regular file is a regular file. So from now what should I do? Thanks for ur help. |
i've not used libmagic to be honest, it's just the c / c++ bindings to the same backend that the "file" program uses.
|
All times are GMT -5. The time now is 07:31 AM. |