Answer the question
In order to leave comments, you need to log in
Is it possible to process strings at compile time?
I have a program that stores many long paths to its elements in its code. I would like to do something like a macro or something similar. For the following to happen.
wstring data = WMACROS(L"%pathToLogs%\\Errors.log");
wstring data = L"ProgramData\\AllLogs\\WebData\\{СЛУЧАЙНАЯ СТРОКА, КОТОРАЯ ГЕНЕРИРУЕТСЯ ПРИ КОМПИЛЯЦИИ}\\Logs\\Errors.log";
Answer the question
In order to leave comments, you need to log in
A RANDOM STRING THAT IS GENERATED WHEN COMPILING
You can do this:
#define TO_LOGS(str) "ProgramData\\AllLogs\\WebData\\14.08.2020\\Logs\\" str
cout << TO_LOGS("Errors.log") << endl;
//=> ProgramData\AllLogs\WebData\14.08.2020\Logs\Errors.log
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question