<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 27 April 2018 at 15:16, akgrant43 <span dir="ltr"><<a href="mailto:notifications@github.com" target="_blank">notifications@github.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><p>Hi Vincent & Eliot,</p>
<blockquote>
<p>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.</p>
</blockquote>
<p>I think it is worse than that.  If I use the following test code in a<br>
cygwin terminal:</p>
<pre><code>#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);
}
</code></pre>
<p>And compile it with mingw:</p>
<pre><code>$ i686-w64-mingw32-gcc -m32 consolestdio.c
</code></pre>
<p>It won't recognise EOF (Control-D).</p></blockquote><div><br></div><div>Try Ctrl-Z</div><div>"In a non-Cygwin Windows program, Ctrl-Z on input triggers an end-of-file condition."</div><div> <a href="https://stackoverflow.com/questions/39327818/reading-till-eof-in-java-on-cygwin-on-windows-10">https://stackoverflow.com/questions/39327818/reading-till-eof-in-java-on-cygwin-on-windows-10</a></div><div><br></div><div>cheers -ben</div></div></div></div>