i want to write a code which determines whether a file is executable or relocatable.....i have try this code but its now working ...
#include<stdio.h>
#include<elf.h>
int main()
{
int fd;
elf32_ehdr myhdr;
fd=open("abc.c");
if (myhdr.e_type==ET_RELl)
{
printf(:relocatable");
if (myhdr.e_type==ET_EXEC)
printf(executable");
else
printf(:other type");
return(0);
}