万里长风破浪 2017-03-08 01:40 采纳率: 0%
浏览 7260

关于c++中getline函数是否会读入换行符的问题

c++中有一个getline函数 可以将输入流中的一行读取到string对象中 那么当读取完成后 换行符会不会留在输入流中 需要在下一步使用ci.get()来丢弃换行符吗

  • 写回答

2条回答 默认 最新

  • oyljerry 2017-03-08 03:14
    关注

    The extraction also stops if the end of file is reached in is or if some other error occurs during the input operation.

    If the delimiter is found, it is extracted and discarded (i.e. it is not stored and the next input operation will begin after it).

    它会主动丢弃换行符

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料