C++ 在C++;
我查看了论坛,但发现如下:C++ 在C++;,c++,windows,ofstream,C++,Windows,Ofstream,我查看了论坛,但发现如下: ofstream outfile; outfile.open ("test.txt"); outfile.open ("\\data\\test.txt"); 但我想在同一级别的目录中打开一个文件。我该怎么做 我的C++ exe文件在发布目录中,我需要在日志目录中打开一个文件。 root -somefolder --release --test --log 这不起作用: outfile.open(".\\log\\test.txt",ios::app) 尝试ou
ofstream outfile;
outfile.open ("test.txt");
outfile.open ("\\data\\test.txt");
但我想在同一级别的目录中打开一个文件。我该怎么做
我的C++ exe文件在发布目录中,我需要在日志目录中打开一个文件。
root
-somefolder
--release
--test
--log
这不起作用:
outfile.open(".\\log\\test.txt",ios::app)
尝试
outfile.open(“..\\log\\test.txt”,ios::app)
一个点是当前目录。是的。如有疑问,请键入文件所在的整个位置。