[Scottish] type of files

Huard, Elise - D C&W Consultant scottish at mailman.lug.org.uk
Wed Aug 28 15:59:00 2002


Hello,

may be slightly off-topic, but not completely : how do you access the type
of a file in a C program (under Linux/Unix) ?
using the path, i want to be able to determine whether it is a shell, an
executable ...
What i found looking in my C book and browsing through man pages : the
f_flags of filehdr should give some indication, apparently.  Unfortunately i
don't know how to get to this filehdr, and i studied every stdio function i
could think of.
There's always the rather inelegant call to 'system()' using 'file' command,
but there must be a nicer way.

(this might be a stupid question but i've not programmed in C that much)

Thanks,

Elise
***********************************************************************************
This email and any accompanying files are confidential.      If you are
not  the  intended recipient  you  must not use,  copy or disclose the
content.   If you have received this email in error please contact the 
sender by return email and delete this message. 
Thankyou for your co-operation.
*************************************************************************************