简体   繁体   中英

using while(! infile.eof()) Curious how to break it before eof() in C++

I am going through a file looking for specific words

Char[50]=getline(file,/n)

using getline to store each line into an char array to compare to the string(s) I am looking for

If( “<”x “>”==char[50]) || (“<” y “<”==char[50])||(“<”z“>”==char[50])
    Break;

Will using break , break me out of the loop early?

Yes, but the b needs to be lowercase.

break;

Will get you out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM