C++,C里如何读取一行任意长度且有空格的字符串
我在网上找的要么不能任意长度要么不能有空格,要任意长度也要空格怎么办?
2016-10-17 23:49
程序代码:#include <iostream>
#include <fstream>
#include <string>
int main( void )
{
std::ifstream is( "a.txt" );
for( std::string line; std::getline(is,line); )
std::cout << line << '\n';
return 0;
}
2016-10-18 08:40
2016-10-18 09:18
2016-10-18 22:16
2016-10-18 23:04
[此贴子已经被作者于2016-10-31 12:06编辑过]
2016-10-31 12:03