c - How to retrive binary version number from binary files -
i using eclipse ide developing c programs. through terminal can see file info using file filename .but need print version number of binary file through same code.i think eclipse ide keeps build , debugging versions .how retrive binary version number binary files ?.
thanks .
the "file" utility non-trivial implementation, ie., no straight-forward system calls getting information. have 2 options:
- get source code of "file" utility (here) , manipulate goal
- easier: use
popen()
, run file command, retrieve output , parse information want. commandfile <filename> | cut -d"," -f3
should directly give version of executable. example of usingpopen()
here
hope helps.
Comments
Post a Comment