I don’t know how to define a macro string with variable, like this:
#define str(x) "file x.txt", that mean I desire that str(1) refers to “file 1.txt”.
However, in the case, str(1) or any number refers to “file x.txt”, because x is an character.
Is there any way to solve this?
I don’t know how to define a macro string with variable, like this: #define
Share
Concatenate the strings:
This makes use of a lexical feature of the two languages: adjacent string literals are concatenated; see both C++11 2.2/6 and C11 5.1.1.2/6: