Code Bye

关于迭代器删除


本人是用迭代器按行删除的,但是有的文件的行数不一样,所以能不能删除Station information and sounding indices以及之后的全部内容呢?
问一下改怎么改代码呢?谢谢。
解决方案

40

for (int i = 0; i < 6; i++)
		getline(infile, str);
	while (getline(infile, str) && strcmp(str, "Station information and sounding indices"))
		v1.push_back(str);
	infile.close();

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明关于迭代器删除