Because of this POV-Ray issue, I wanted to figure out what is the most secure and stable way to read a file line by line in C++ using a std::ifstream in combination with std::getline(). Furthermore, it was the aim to provide as precise error messages as possible. It turned out that dealing with the error bits eofbit, failbit, and badbit is already challenging, as discussed for e.g. here, here, and here, and finally at cplusplus.com. Even in the latter case you are not provided with all details and the optimal solution. Regarding error messages, it is getting more complicated. Evaluating errno, respectively perror(), at the same time as the error bits is not trivial as can already be inferred from discussions like this and this. But after some testing and carrying together all available information it turns out that there are good recipes to follow.
Update (July, 7th, 2011): I revised the whole article due to an important insight provided by Alexandre Duret-Lutz (confer comments).