Did you like how we did? Rate your experience!

4.5

satisfied

46 votes

How do you adjust your program to read a file line-by-line without?

In C you'd have to use nonstandard extensions such as the POSIX getline. OR you'd have to implement something like that yourself from one or multiple calls to fgets. C++ has the std::string type. For C++ istream (usually used either as the cin object or as an ifstream) you can use the getline method of such a stream with a C++ string and the string will be auto resized as needed.

100%
Loading, please wait...