Hi fellows,
I have been given the darness task of determining whether a file is an executable or not. I know there is a shell command called file that does this. I was wondering if it can be done in c, or a combination of the two, since I need to perform some things to the executable file inside the c program.
I have been googling alot but have found only that files have magic number at the header that tells the kernel what type it is. However there is nothing I could find that tells me how to access this number or what number it is that determines if the file is an executable or not. I need an answer asap please. thanks.
oh btw, i'm working under the ext2 file system (linux) if that is of any relevance.
supernewb.