you can use STL for reading:
std::string first_line;
std::ifstream is( "input.txt");
std::getline( is, first_line );

that helps you to avoid buffer size definition.