下面的错误怎么处理? 类型是对的啊 string类
#include<iostream>#include<string>#include<fstream>using namespace std;
int main(){ string str,str1; str="hello"; cout<<sizeof(str)<<endl; str="Hello world!"; cout<<sizeof(str)<<endl; //string类只是一个指针,所以两个返回值相同都h是4
ofstream fout("abc.txt",ios::app); fout<<str<<endl; cout<<"input a line string:"<<endl; getline(cin,str1); fout.write((char*)&str1.c_str(),str.size()); return 0;}