Aquarius_Girl
Aquarius_Girl

Reputation: 22946

How to read uptill a particular character in a file, without going through the file, character by character?

Want to detect the '\n' without going through each and every character of a text file. Any hints?

Upvotes: 2

Views: 124

Answers (2)

Manjabes
Manjabes

Reputation: 1904

How about getline(...) from Iostream?

http://www.cplusplus.com/reference/iostream/istream/getline/

Upvotes: 3

Mat
Mat

Reputation: 206879

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.

Upvotes: 3

Related Questions