diff --git a/c-programming/io/freadln.c b/c-programming/io/freadln.c index 6f7c867..36a0ea2 100644 --- a/c-programming/io/freadln.c +++ b/c-programming/io/freadln.c @@ -4,6 +4,9 @@ * The `freadln` function reads a line from STDIN into a string, allocating * memory for it. * + * NOTE: Test: Declare macro POSIX when compiling if you're using a POSIX + * system. + * * TODO: Figure out potential problems * TODO: Add 'flushing' of STDIN (while there are characters, read them) before * the input reading loop to avoid input queues @@ -76,7 +79,11 @@ int freadln(FILE* f, char** output, size_t* length_out) { } #ifdef TEST -# if defined(_WIN32) || defined(WIN32) +# if POSIX +# include +# define SLEEP_FN sleep +# define DO_SLEEP 1 +# elif defined(_WIN32) || defined(WIN32) # include # define SLEEP_FN(x) Sleep((DWORD) x) # define DO_SLEEP 1