0
ofstream을 사용하여 만든 파일에 문자열을 써야하지만 오류가 발생합니다.문자열을 C++ 파일 (QT4)에 쓰기
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
QString aux = "Hello";
ofstream myfile ("test.txt");
if (myfile.is_open())
{
myfile << aux;
myfile.close();
}
else
{
cout << "CANT OPEN FILE";
}
return 0;
}
오류는 다음과 같습니다 :
이
코드입니다 내가 QT4감사
을 사용하고 있습니다 :PS '< <가 보조은 myfile'에서 '연산자 < <'에 대한 일치 너의 도움으로!
'myfile << qPrintable (aux);'또는'ofstream' 대신'QTextStream'을 사용하십시오. – drescherjm