我正在尝试使用ofstream
(C++ Builder)将文本文件保存到特定目录。我在使用 Windows 7 时遇到问题。
// Works fine at Windows XP and Windows 7
std::ofstream file1("Name.txt");
// Works fine at Windows XP but not at Windows 7
std::ofstream file1("Folder1/Name.txt");
// Works fine at Windows XP but not at Windows 7
std::ofstream file1("Folder1\\Name.txt");
如何使用 Windows 7 将“.txt”文件保存到特定目录?
OBS:当我使用 Windows 7 保存程序时,文件保存在:
C:\Users\Name\AppData\Local\VirtualStore\Folder1\Name.txt