我正在使用ifstream,我需要用两个单词作为一个字符串读取而不是分开它们
我需要从文件中读取一行,但是我需要将两个字符串作为一个。例如,如果文件的行有某人的名字,例如Bernie Sanders
,我想将整个名称保存到字符串变量中,而不仅仅是名字。
I need to read in a line from a file, but I need to save two strings as one. For example, if the file's line had someone's name like Bernie Sanders
, I would want to save the entire name into a string variable instead of just the first name.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您正在
这样做会读取到一个单词的结尾。
相反,
这将读取整行
I assume you are doing
this will read to the end of a word.
do this instead
this will read the whole line