I need help reading lines from text files. I have been trying to read the first line just using getline(stream,line) assuming that my text file starts on the first line. This line of the text file is supposed to tell you how many lines there are so the next step I wrote while(x<= line) but I am unsure of how to read the 2nd or 3rd etc. line. Thanks in advance.
jt1250champ
0
Newbie Poster
Recommended Answers
Jump to PostThis thread should help
Jump to Postdo { buffer[0] = 0; strm.getline(buffer, BUF_SIZE); if (::strlen(buffer) > 0) { // Process buffer. } } while (!strm.eof() && !strm.bad());
All 5 Replies
tinstaafl
1,176
Posting Maven
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
mridul.ahuja
4
Coding Enthusiast
iamthwee
new_developer
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.