Possible Duplicate:
Stringification of a macro value
I want to write a C macro that takes a “sequence of characters” (for example, #define macro(sequence)) and return the quoted string "sequence", so the macro should create "\"sequence\"". I know I can do #sequence but this just returns "sequence" which is not what I’m looking for… I must say that "sequence" is another macro, so I can’t write it as it is in this macro since it gets “non literally” replaced. Any ideas?
Use
#sequencebut add the quotes before and after:The string literals will be concatenated giving you the result you want.
For example:
Will print
"hello"(including the quotes).