[PATCH #57] Fixed several issues with win_x_fread()

This commit is contained in:
Jim Monte 2019-06-01 17:06:07 +02:00 committed by Holger Vogt
parent f9a4800d86
commit 8f2677438b
1 changed files with 6 additions and 6 deletions

View File

@ -1187,20 +1187,20 @@ win_x_fread(void *ptr, size_t size, size_t n, FILE *stream)
if (stream == stdin) {
size_t i = 0;
int c;
char s[IOBufSize];
char *s = (char *) ptr;
while (i < (size * n - 1)) {
c = w_getch();
if (c == LF) {
// s[i++] = LF;
break;
}
if (c != CR)
s[i++] = (char)c;
if (c != CR) {
s[i++] = (char) c;
}
}
// s[i] = SE;
ptr = &s[0];
return (size_t)(i / size);
}
return (size_t) (i / size);
} /* end of case of stdin */
return fread(ptr, size, n, stream);
}