Where/how to get the "getline" function if it is missing from stdio.h?

Blackstar picture Blackstar · Dec 9, 2014 · Viewed 15.9k times · Source

I'm writing a program in C using Code::Blocks 13.12 on Windows 8 (the C compiler is mingw32-gcc). I would like to use the "getline" function but it seems to be missing from the stdio.h. Is there any way to get it except for writing own implementation?

Answer

rubenvb picture rubenvb · Dec 9, 2014

getline is a POSIX function, and Windows isn't POSIX, so it doesn't have some POSIX C functions available.

You'll need to roll your own. Or use one that has already been written.