WITH
Since you marked C and want to use a macro solution, use # in the macro
#define FILENAME(NUM) "results"#NUM".txt" ^^^^^ char *fname = FILENAME(5);
Be careful, therefore you cannot use variables.
int number = 5; char *fname = FILENAME(number);
Otherwise, you must use functions to use variables.
C ++
made everything easier
std::string FileName(int d) { return "results"+ std::to_string(d) +".txt";
source share