This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Sub String in Pre-Processor?

Does anyone know how to get the pre-processor to spit out a substring? In this case, I want to include only the year from the __DATE__ macro.
Something like:

#define YEAR=substr(8,4,__DATE__)
const char code ROMSTRING={"COPYRIGHT " YEAR "by such and such company. Compiled on " __DATE__};

where the #define is something the pre-processor can handle.

Thanks

Parents
  • The ISO/IEC 9899:1999(E) document says in paragraph 6.7.8 note 14:

    "An array of character type may be initialized by a character string literal, optionally enclosed in braces. Successive characters of the character string literal (including the terminating null character if there is room or if the array is of unknown size)initialize the elements of the array."

Reply
  • The ISO/IEC 9899:1999(E) document says in paragraph 6.7.8 note 14:

    "An array of character type may be initialized by a character string literal, optionally enclosed in braces. Successive characters of the character string literal (including the terminating null character if there is room or if the array is of unknown size)initialize the elements of the array."

Children