If only it were that easy, I would not have wasted people's time by asking. It seems hard to get good help these days.
If you check the "FILE" C++ Help, you will see that it produces a String that includes the entire file-Path.
Also, IF the file naming convention use for another project doesn't have the exact same structure as this project then "10" could and would be anything.
Old Army saying, "Lead, Follow or get out of the way." The "10" seems to fit in there somewhere.
oqibidipo:
I think you forgot to count the '\0' at the end.
Nope. I assumed, given @SalineSolution's condescending attitude, he would not bother with anything else I wrote so I did not bother putting any thought into my post beyond making it understandable.
I also assumed anyone who had an interest, like you, would easily find any mistakes I made.
This will give the character at the place of X and is easy to update if the file suffix is changed.
you will see that it produces a String that includes the entire file-Path
It most certainly does NOT!
I believe this is a complaint about "String" (which would be a C++ String data type), rather than about the presence of the path in the C-style null-terminated character array literal...
Due to the change from FILE containing just the filename, I find I need to re-acquire just the filename for versioning purposes. (I display the filename in a 2x16 display). Any thoughts on how to do this without implementing sed or perl would be welcomed!
char tmp[] = __FILE__;
char *ptmp;
// Point to last char in string
ptmp = &tmp[strlen(tmp)-1];
// Go backwards through the string until we either
// find a backslash or reach the beginning of the string
while((ptmp > tmp) && (*ptmp != '\\'))ptmp--;
// If we found a backslash move forward one char to the
// start of the filename
if(*ptmp == '\\')ptmp++;
Serial.print("Start ");
Serial.println(ptmp);