How to read uptill a particular character in a file, without going through the file, character by character?
Want to detect the '\n' witho开发者_运维问答ut going through each and every character of a text file. Any hints?
Something has to read all the bytes to check for that delimiter.
Use one of the getline
(or istream::getline) functions so that the library does the searching, not your code.
How about getline(...)
from Iostream?
http://www.cplusplus.com/reference/iostream/istream/getline/
精彩评论