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?
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.
getline
is not a standard C library function. Some implementations (such as gcc
) provide it as an extension.
If you're compiling with gcc, you'll need to define the feature macro _GNU_SOURCE
in order to make it available for your code:
#define _GNU_SOURCE
#include <stdio.h>
...
getline (...);
EDIT
Hopefully since mingw is a GNU compiler, this should be available for you on windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With