Why i can't use Windows Environment path shortcut with ofstream to write a sample text file ?
\\ C:\Users\Me\AppData\Local\Temp\Test.txt
std::string Path = "%Temp%\\Test.txt"
ofstream myfile;
myfile.open (Path);
if (!myfile.is_open())
{
cout << "Could not create temp file." << endl;
}
myfile << "Hello World";
myfile.close();
myfile.is_open() always return false, also "%%Temp%%" and "\%Temp\%" not working.
I can get Temp path by Windows API, but i don't want to use API in this application.
Thank you