i want to write a code which determines whether a file is executable or relocatable.....i have try this code but its now working ...

int main()
int fd;
elf32_ehdr myhdr;
if (myhdr.e_type==ET_RELl)
if (myhdr.e_type==ET_EXEC)

printf(:other type");



That file is neither object file or executable file. Its a C script file. On MS-Windows you can easily tell the difference between object and executable by its file extension. On *nix executable files do not normally have extensions, but you can identify them by the file permissions mask. And with that you would not know the difference between a compiled executable program or a shell script, which is just a text file.