Hi Vincent & Eliot,
Ugh. I didn't realize one couldn't use the same code in both :-(. I guess we have to test to find out what the context is and use dread in one and ReadConsole in the other.
I think it is worse than that. If I use the following test code in a
cygwin terminal:#include <stdio.h> #include <stdlib.h> int main() { char buf[1024]; char *bufp; int cread; int count = 0; bufp = &buf[0]; do { cread = fread(bufp, 1, 1, stdin); count += cread; bufp += cread; if (count > 16) break; } while (cread > 0); buf[count] = 0; if (! feof(stdin)) fprintf(stderr, "Error, not at end of file\n"); printf("--\n"); printf("%s\n", buf); printf("--\n"); printf("Read %d characters\n", count); exit(0); }
And compile it with mingw:
$ i686-w64-mingw32-gcc -m32 consolestdio.c
It won't recognise EOF (Control-D).