Oh yeah one last IMPORTANT and HELPFUL note, binary executable files have a magic bit that can also help to identify them... this is VERY important
EX:
A file’s first 4 bytes hold a ‘‘magic number,’’ identifying the file as an ELF object file. 0x7f I believe is what it is...
EX:
Code:
char base[8];
char ELF[5];
ELF[0]=0x7f;
ELF[1]='E';
ELF[2]='L';
ELF[3]='F';
ELF[4]='\0';
ifstream in("filename");
int j=0;
for(j=0;j<4;j++)
in.getc(base[j]);
base[4]='\0';
if(!strvcmp(base,ELF,strlen(ELF)))
cout<<"The file is an ELF Executable file"<<endl;
-LC