从文件中读取并在字符串后获取所有字符串
我有这样的东西:
while (getline(names_f, line) && getout == true)
{
istringstream linestream(line);
linestream >> student_id >> student_name >> student_surname;
只要我有一个函数要考虑名称中的中间名,我就需要在student_id
之后拥有整个行(student_stenter_name>> student_surname
)
是否可以从student_id
的末尾解析此阅读?
I have something like this:
while (getline(names_f, line) && getout == true)
{
istringstream linestream(line);
linestream >> student_id >> student_name >> student_surname;
As long as I have a function to consider if there is a middle name in the name, I need to have the whole line after student_id
(student_name >> student_surname
)
Is it possible to parse this reading from end of student_id
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正则表达式使您可以做到这一点,此外,还从语法的角度检查每行是否正确(例如,如果它们以数字开头,是否具有
n
字段,依此类推)。[demo]
Regular expressions let you do that and, besides, check if every line is correct from a syntax point of view (e.g. if they start with a number, if they have
n
fields, and so on).[Demo]