[Solved] C++ fstream getline parameters


If you mean std::basic_stream::getline(), you provide a pointer to character array and the size of that array. You have to create the array somewhere by yourself. If some line is longer than sz - 1, only part of it with length sz - 1 will be read.

If you don’t know the maximum length of lines in the input file, it’s better to use std::getline(), for example like this:

std::string line;
std::getline(file, line);

solved C++ fstream getline parameters