Flush file in fputc when character is '\n'.
This commit is contained in:
parent
36aee71988
commit
b100339e2f
|
@ -2220,11 +2220,17 @@ int MSVCRT__flsbuf(int c, MSVCRT_FILE* file);
|
||||||
int MSVCRT_fputc(int c, MSVCRT_FILE* file)
|
int MSVCRT_fputc(int c, MSVCRT_FILE* file)
|
||||||
{
|
{
|
||||||
if(file->_cnt>0) {
|
if(file->_cnt>0) {
|
||||||
*file->_ptr++=c;
|
*file->_ptr++=c;
|
||||||
file->_cnt--;
|
file->_cnt--;
|
||||||
return c;
|
if (c == '\n')
|
||||||
|
{
|
||||||
|
int res = msvcrt_flush_buffer(file);
|
||||||
|
return res ? res : c;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return c;
|
||||||
} else {
|
} else {
|
||||||
return MSVCRT__flsbuf(c, file);
|
return MSVCRT__flsbuf(c, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue