C++中的getline()方法

版权声明:若需要转载,请标明原文地址。 https://blog.csdn.net/qq_41903671/article/details/89605650

博主这里记录的是istream中的getline()函数,其有两种重载形式:

  1. getline (char* s, streamsize n );
    从istream中读取至多n个字符,包含结束标记符,保存在s对应的数组中,即使还没有读够n个字符,也会保存。
  2. getline (char* s, streamsize n, char delim )
    遇到delim或者字数达到了一定的限制,那么读取就会终止,deline不会被保存在对应的数组中。

猜你喜欢

转载自blog.csdn.net/qq_41903671/article/details/89605650