input.c: bug in MS VS 2015: if in text mode, _read returns 0 instead of 1 after reading '\n' (end of line)
This commit is contained in:
parent
9424a4e937
commit
fdd62c8f63
|
|
@ -41,6 +41,13 @@ inchar(FILE *fp)
|
||||||
i = read(fileno(fp), &c, 1);
|
i = read(fileno(fp), &c, 1);
|
||||||
while (i == -1 && errno == EINTR);
|
while (i == -1 && errno == EINTR);
|
||||||
|
|
||||||
|
#if _MSC_VER == 1900
|
||||||
|
/* There is a bug in MS VS2015, in that _read returns 0 instead of 1
|
||||||
|
if '\n' is read from stdin in text mode */
|
||||||
|
if (i == 0 && c == '\n')
|
||||||
|
i = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (i == 0 || c == '\004')
|
if (i == 0 || c == '\004')
|
||||||
return EOF;
|
return EOF;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue