Flush file in fputc when character is '\n'.

This commit is contained in:
Juan Lang 2004-12-07 17:05:08 +00:00 committed by Alexandre Julliard
parent 36aee71988
commit b100339e2f
1 changed files with 10 additions and 4 deletions

View File

@ -2220,11 +2220,17 @@ int MSVCRT__flsbuf(int c, MSVCRT_FILE* file);
int MSVCRT_fputc(int c, MSVCRT_FILE* file)
{
if(file->_cnt>0) {
*file->_ptr++=c;
file->_cnt--;
return c;
*file->_ptr++=c;
file->_cnt--;
if (c == '\n')
{
int res = msvcrt_flush_buffer(file);
return res ? res : c;
}
else
return c;
} else {
return MSVCRT__flsbuf(c, file);
return MSVCRT__flsbuf(c, file);
}
}