A modern API would be three functions (ReadFirstLine, ReadLastLine, ReadNthLine) or a clear enum. The current scheme works because it's used in only a few places. Close without a file handle in both ...