不是stringstream很方便,而是STL很方便.不要前面使用stringstream,后面使用C函数.你这里stringstream是多余的.可以 ofstream of( pszFilename ) ;of <<a<<b<<"aaaaa"<<"aaaa"...(子子孙孙无穷尽也); //这里的数据已经到文件了.没必要中间插个stringstream.stringstream是弥补输入设备(CIN), 输出设...
std::stringstream ssTest;ssTest<<"welcome to https://blog.51cto.com/fengyuzaitu"<<std::endl;ssTest.clear();std::cout<<ssTest.str(); 1. 2. 3. 4. 必须使用str("") std::stringstream ssTest;ssTest<<"welcome to https://blog.51cto.com/fengyuzaitu"<<std::endl;ssTest.str("");ss...