View previous topic :: View next topic |
Author |
Message |
AdamWebber
Joined: 18 Jun 2014 Posts: 13
|
Exporting __DATE__ and __TIME__ |
Posted: Tue Aug 11, 2015 9:39 am |
|
|
I am currently exporting the HEX file with the date compiled in the filename. The problem that I currently face is that I need to define the date manually. If I attempt to define the date as:
#define DATE __DATE__
it throws the quotation marks into the mix and Windows hates quotation marks in filenames.
So here is my current operational code:
Code: | #define DATE 11_AUG_2015
#define EXPNAME(a,b,c) a ##b ##c
#export (HEX, FILE = EXPNAME(MY_FILENAME_,DATE,.hex))
|
What I would like to use is the following:
Code: | #define DATE __DATE__
#define EXPNAME(a,b,c) a ##b ##c
#export (HEX, FILE = EXPNAME(MY_FILENAME_,DATE,.hex))
|
Is there a way to remove the quotation marks from the date using the macro #define or any other method so that I can put the date automatically into the filename? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19382
|
|
Posted: Tue Aug 11, 2015 11:08 am |
|
|
I'd say 'no'. Hopefully somebody will prove me wrong now!...
The value returned by __DATE__, is a string. Hence easy to use in things like printf. Now a macro argument can be converted to a string (# does this), hence it is sometimes referred to as the 'stringifying' operator. You'd need a 'de-stringifying' operator, but I don't think one exists. |
|
![](templates/subSilver/images/spacer.gif) |
AdamWebber
Joined: 18 Jun 2014 Posts: 13
|
|
Posted: Wed Aug 12, 2015 11:06 am |
|
|
Thanks for the info. I can't say that I was very positive in finding a solution as I didn't expect a solution to be available. My cohort and I were trying to find a method but we became stumped. But if anyone else can think of something, it would be welcome and appreciated. |
|
![](templates/subSilver/images/spacer.gif) |
jeremiah
Joined: 20 Jul 2010 Posts: 1329
|
|
Posted: Thu Aug 13, 2015 2:24 pm |
|
|
What I do is stick to a numeric version:
Filename_YYYYMMDD.hex
I know it isn't exactly what you want but I like how it sorts alphabetically. |
|
![](templates/subSilver/images/spacer.gif) |
|