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:

  1. get source code of "file" utility (here) , manipulate goal
  2. easier: use popen(), run file command, retrieve output , parse information want. command file <filename> | cut -d"," -f3 should directly give version of executable. example of using popen() here

hope helps.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -