fstream 不工作...尝试了我能找到的一切

问题描述 投票:0回答:0

我正在使用 fstream 将我的数据输出到 csv。 它调试正确,isopen() 也返回 true,但文件没有更改。 我创建了简单的测试代码但同样的事情......

我正在使用 MinGW g++ 和 vscode

没有任何作用,不创建新文件(即使它有 app 参数), 即使有文件也不起作用。 请帮助,我尝试了所有我能找到的东西,我在谷歌搜索中位于第 3 页。

我已经尝试过ofstream,fstream, 我试图导出为 .txt 文件(不是 csv), 我尝试使用 .open("test.csv",ios::in) 单独打开它, 我检查了文件是否在随机位置创建但找不到, 我试过在管理员中打开 vscode。

#include <iostream>
#include <math.h>
#include <iomanip>
#include <time.h>
#include <fstream>
#include <string>

using namespace std;

int main()
{
    fstream myFile("test.csv",ios::in | ios::out | ios::app);
    myFile<<"asdf"<<endl;
    myFile.close();
}
c++ mingw fstream
© www.soinside.com 2019 - 2024. All rights reserved.