这应该在我的项目目录中创建一个名为"tuna.txt"的文件.当我运行它时,它成功编译,但是没有创建文件.我在使用xcode的mac上.我已经在我的计算机上搜索了可能已经创建的其他地方,但似乎文件根本就没有创建.关于它为什么不起作用的任何想法?
#include <iostream>
#include <fstream>
using namespace std;
int main(void){
ofstream file;
file.open("tuna.txt");
file << "I love tuna and tuna loves me!\n";
file.close();
return 0;
}
Run Code Online (Sandbox Code Playgroud)