Aug 30, 2019 at 11:06pm UTC
I necessarily need to change backslash to forward slash in windows environmental variable. Do you have any suggestions how can I get %programdata% path with forward slash after systemDrive?
1 2 3
TCHAR path[_MAX_PATH];
_tcscpy(path, programdata);
_tcscat(path, _T("\\myfile.txt" ));
Last edited on Aug 31, 2019 at 9:44am UTC
Aug 31, 2019 at 9:13am UTC
No, it's not a solution because programdata is not always the system drive subfolder:(
Last edited on Aug 31, 2019 at 9:13am UTC
Aug 31, 2019 at 12:43pm UTC
Solved:
1 2 3
typedef std::basic_string<TCHAR> tstring;
tstring pathbasic = tstring(programdata) + _T("\\myfile.txt" );
std::replace(pathbasic.begin(), pathbasic.end(), _T('\\' ), _T('/' ));
Last edited on Aug 31, 2019 at 12:44pm UTC
Sep 2, 2019 at 7:02pm UTC
Of course it's solved, you spammed the same question on at least 3 forums.