while (getline(istream,line)) if (strcmp(specialStr.c_str(), line.c_str()) !{ } { }}
我使用getline逐行读取std::istringstream中的行,直到我“遇到”特殊字符串,之后我应该对接下来的行进行一些特殊处理。-----------
我只是试图读取CSV文件并将其打印在终端上,但我认为getLine()函数并不是解析行字符的末尾。我认为这是因为我正在读的文件是在Windows上创建的,我是在Linux上运行脚本的。为了测试这个理论,我在Linux上创建了一个新的CSV文件,但是它也有同样的问题。readCsv.eof()){ getline(readCsv, in, ',');
ge
我正在尝试从一个已经打开的文件中执行一个简单的getline,然而,编译器总是给我错误。我试过找其他有这些问题的人,但我找不到其他有这些问题的人。有什么建议吗?&inputFile)// Read in the data, parse it out, and string input; getline‘void Airworthy::readData(std::ifstream&)’:
Foo.cpp:25:27:
我希望在C++中使用相当于C++的C语言:getline(std::cin,s); // reads an arbitrarily long line and我在找像这样的东西:getline(stdin,s); // allocates the space necessary to fit the read// line and make s point to it
编辑:我最终决定使用POSIX getline函数,因为我在<