More portable

tested with:
Embarcadero C++ Builder XE2 (Windows)
gcc 4.5 linux
gcc 4.9 MacOS X
llvm 5.1 MacOS X
gcc 4.8 Android ARM/ARMv7/MIPS/x86

if system have fgetln use -D_HAVE_FGETLN_ it is faster