I prefer:
void parseLine(std::ifstream& file)
{
std::string line;
while(std::getline(file, line))
{
// some treatment
}
}
Comments on your code:
int parseLine(std::ifstream & _file)
// ^^^ be careful with identifiers that start with _
Do you know all the rules? They are non trivial so best to just avoid '_' as a leading character.
This while loop does not buy you anything.
while( std::getline( _file, line, '\n' ).good() && !_file.eof() )
The result of std::getline() is a reference to a stream. When used in a boolean context it will be converted to a bool automatically (using the cast operator). This conversion will call good() so there is no point in calling it manually.
If the file is good() then eof() will not fail.
If you always return the same value
return 0;
Then why have a return value.
One thing about code it should be obvious what the code is doing with the need for extra comments. Comments mean the code is complex and needs additional explanation. But to make the code easy to read you should also use identifiers that convey some meaning.
void parseLine() // looks like it will read one line.
The term parseLine() is actually misleading here. As you don't parse a line. You parse the whole file.