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).
它会主动丢弃换行符
解决 4无用