Re: std::getline size limit
Quote:
Originally posted by dirkduck
Hi everyone. I'm reading in each line off a file through std::getline(source,line,'\n'), but I've noticed that if the line is longer than 255 (or maybe it is 256...) characters, then the program will crash. "line" is an std::string so i don't think it has size restriction of 256. Is there a way to bypass this problem? Thanks.
Hmm...doesnt crash for me.....can you follow the code throught the debugger to see exactly what point it crashes at?
If it's a memory thing, try std::string::reserve with a count higher than the bytes read. See if that has an effect.