Accessing VirtualStore??

Trying to read/write from a file located only in the virutal store. Having trouble loading the file in using

outputFile.open("%localappdata%\virtualstore\Program Files (x86)\AGC\test.txt");

and

outputFile.open("%localappdata%\\virtualstore\\Program Files (x86)\\AGC\\test.txt");

Although I can get it to work using:

inputFile.open("C:\\Users\\Newlance\\AppData\\Local\\VirtualStore\\Program Files (x86)\\AGC\\settingsV5.cfg");

But I need it to work on other machines IE: Not Newlance. Any help would be appreciated!
Last edited on
I suppose you could use `getenv()'
UPDATE:

Not sure if this is the easiest way, but I got it working using:

1
2
3
4
5
6
7
8
9
	string location = "\\virtualstore\\Program Files (x86)\\AGC\\test3.txt";
	TCHAR szPath[MAX_PATH];

if(SUCCEEDED(SHGetFolderPath(NULL, 
                             CSIDL_LOCAL_APPDATA|CSIDL_FLAG_CREATE, 
                             NULL, 
                             0, 
                             szPath))) 
outputFile.open(szPath + location);
Topic archived. No new replies allowed.