Hi there,
I am writing a code to print the results for any given project into the corresponding solution directory. Here is my idea
//*** CODE***//
// In C/C++ properties, Preprocessor, "Preprocess or Definitions":
MY_SOLUTIONDIR= $(SolutionDir)
// In the cpp file:
#define OP OP2(MY_SOLUTION DIR)
#define OP2(x) OP3(x)
#define OP3(a) #a
string print_folder = OP;
print(print_fol der, my_results);
//*** RESULTS***//
MY_SOLUTIONDIR = C:\Projects\My_ project
print_folder = "C: ProjectsMy_proj ect" (here I lose the backslashes)
I need to convert MY_SOLUTIONDIR into a string for my print function. With my 3-level macro OP I manage to add quotation marks to get a string but I have a problem with the backslash as C++ requires double backslashes.
Any idea on how to convert the MY_SOLUTIONDIR into a 'good' string? Any other idea on how to use the $(SolutionDir) of the preprocessor for a function requiring a string as an input?
Many thanks,
Matthieu
I am writing a code to print the results for any given project into the corresponding solution directory. Here is my idea
//*** CODE***//
// In C/C++ properties, Preprocessor, "Preprocess or Definitions":
MY_SOLUTIONDIR= $(SolutionDir)
// In the cpp file:
#define OP OP2(MY_SOLUTION DIR)
#define OP2(x) OP3(x)
#define OP3(a) #a
string print_folder = OP;
print(print_fol der, my_results);
//*** RESULTS***//
MY_SOLUTIONDIR = C:\Projects\My_ project
print_folder = "C: ProjectsMy_proj ect" (here I lose the backslashes)
I need to convert MY_SOLUTIONDIR into a string for my print function. With my 3-level macro OP I manage to add quotation marks to get a string but I have a problem with the backslash as C++ requires double backslashes.
Any idea on how to convert the MY_SOLUTIONDIR into a 'good' string? Any other idea on how to use the $(SolutionDir) of the preprocessor for a function requiring a string as an input?
Many thanks,
Matthieu
Comment