Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

-- How can I include a program version number in UNIX/C

Status
Not open for further replies.

DaniDak

Technical User
Mar 13, 2002
44
0
0
US
Is there a way when I compile my C program into an EXE in UNIX to associate a version number with my EXE. I know it's possible in Windows, but have never done it in UNIX.

Thanks
 
please be clear, a version number of what ?
-a nothing saying incremented id
-a compiling time stamp
-something related to src-code version
-???

what can you do in window?


:) guggach
 
I suppose that involves storing your version number in a variable within your program (hard-coded), or in a separate file. Provide a function to get your version number when necessary (such as for upgrading information).

In Windows, I believe that is done through registry. Registry is basically a data file. In DOS days, many programs used .dat files to store information (such as user preferences, etc.). Many of these .dat files were actually just plain text files. However, there were problems of conflicting names. Two programs may have the same name for their data files, such as data.dat. Thus, the registry system was invented and the programs basically let Windows handles much of the data storing that the programs require.

In UNIX, I believe the programs must handle much of the data storing themselves. So you either hard-code it or store it in a separate file (much like .dat file).
 
Zech,
in Windows exe version number contains in the exe module as one of its standard attributes (properties), not in the Registry...
 
Ah..ok, thanks for the correction. :)

I suppose that it would be the same as hard-coding the version into your codes then.

 
How about just putting the version number in as part of the name of the program? I know you could just rename it to remove the version number, but it's better than nothing, right?
 
If your source code is under version control (cvs/rcs/sccs), then

Code:
static char *version = "$Id:$";

Or the last time you built the file
Code:
static char *version = __DATE__ " " __TIME__;

--
 
You could use the what command and enbed something like
char sccsid[] = "@(#)identification information";
in your code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top