473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Obtaining a Compilation Datestamp

To help users identify what version of my program they are using, I want it to have an "Identity string" available.

eg
"Prog: Bodgit, Version: 0.0.0, Compiled: 20061215"

The version number would be manually updated, but, just in case I forget, then I want the datestamp to be based on the datea and time the program was compiled/linked. Please can someone tell me whether there is a function available to return this information to me? Many thanks.
Dec 15 '06 #1
4 2175
To help users identify what version of my program they are using, I want it to have an "Identity string" available.

eg
"Prog: Bodgit, Version: 0.0.0, Compiled: 20061215"

The version number would be manually updated, but, just in case I forget, then I want the datestamp to be based on the datea and time the program was compiled/linked. Please can someone tell me whether there is a function available to return this information to me? Many thanks.
Hmm,

As far as i know there is no function in C to get this information. But dont you think this time stamp would be the time stamp at which the C executable was modified.. If it is may be your problem can narrow down to knowing a DOS command which will give us the time at which the executable file was last modified. Which inturn can be used in system function using C.

Regards,
ShaggY@FtF
Dec 15 '06 #2
Thanks for reply - Should have said Linux and G++. Am I right in thinking that there is only one date on a unix file and that by the time this gets FTP'd to the target machine it will have been modified and so not be the date/time when it was created?
Dec 15 '06 #3
Banfa
9,065 Expert Mod 8TB
eg
"Prog: Bodgit, Version: 0.0.0, Compiled: 20061215"
ANSI C/C++ contains some predefined macros as follows

__DATE__
The compilation date of the current source file. The date is a string literal of the form Mmm dd yyyy.

__FILE__
The name of the current source file. __FILE__ expands to a string surrounded by double quotation marks.

__LINE__
The line number in the current source file. The line number is a decimal integer constant.

__STDC__
Indicates full conformance with the ANSI C standard.

__TIME__
The most recent compilation time of the current source file. The time is a string literal of the form hh:mm:ss.

__TIMESTAMP__
The date and time of the last modification of the current source file, expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy, where Ddd is the abbreviated day of the week and Date is an integer from 1 to 31.


So you can achieve what you want with the string

Expand|Select|Wrap|Line Numbers
  1. "Prog: Bodgit, Version: 0.0.0, Compiled: " __DATE__
  2.  
Dec 15 '06 #4
Thank you for both replies. The second one gives me exactly the solution I hoped for - Mike
Dec 15 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Zee Zop | last post by:
How would I find the month and year from something with a datestamp of 1078801582? (The day does not matter)
0
by: Lennart Hoglund | last post by:
Uploading an Image to a Server using the method described in the Knowledge Base article Q315832, works fine and smoothly. Obtaining the Image Size using; ImageSize.Text = New...
6
by: Shaun Heveron | last post by:
Hi, I'm working on a portable ANSI C++ application designed to compile and execute under Windows and LINUX/UNIX. Is there a portable way of obtaining the current working directory? Sorry, if...
0
by: VP | last post by:
Hi there, well i am stuck on a problem with regards to obtaining security permissions on folders. At the moment I have created a simple treeview example which shows all sub-directories in a tree...
8
by: Daniele Baroncelli | last post by:
How can I get the original datestamp of uploaded files? The array $_FILES doesn't seem to contain the original date. Any solution? Daniele
13
by: P | last post by:
Hi, I'm trying to acquire the parameter MAX_CONNECTIONS by using the API. The following is the code segment I used: struct sqlfupd paramItem; paramItem.token = SQLF_DBTN_MAX_CONNECTIONS;...
11
by: seannakasone | last post by:
Is there a way to get the callstack level in c++? for example, take the following code: void call3() { //callstack level would be 3 } void call2() { //callstack level would be 2 call3();
17
by: Phil M | last post by:
Hi all. I have am HTML web page where I upload an updated file which is always called document.pdf. Users get there, click on the icon and download the document.pdf. Below the icon/link where...
1
by: jpgoeth1 | last post by:
Hi, I'm brand-new to access 2007 and I need a little help building my first database. I'm importing from a text file and I'd like to add a datestamp as a separate column. This would hold the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.