How to solve my bug with getline

C

Christopher

I recently ran into a bug that I was not expecting at all (well, I
guess you never do)
I am using fstream:::getline, which asked for a buffer of type char *.
I made my buffer size 255 thinking I was safe. When I went to parse a
file that contained an extremely long line, my program parsed the data
incorrectly, but kept going!

How can I check whether or not the entire line was obtained?

What is a better way to ensure I always get the entire line? Isn't
there some way to replace getline and the static sized buffer with
something that will grow as large as needed?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top