Changeset 878 for cpp


Ignore:
Timestamp:
05/17/19 02:35:31 (5 years ago)
Author:
Maciej Komosinski
Message:

Fixed fputs("") reporting an error in Android MFILE implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/nonstd_stdio.cpp

    r841 r878  
    303303{
    304304        int len = strlen(txt);
    305         int res = mfwrite(txt, len, 1, f);
     305        if (len==0) //when writing X 0-byte elements, fwrite() will return 0 ("0 elements written" instead of "X elements") but this is not an error
     306                return 1; //for simplicity, we don't even try to write 0 bytes and report a success
     307        int res = mfwrite(txt, len, 1, f); //write 1 element of len bytes
    306308        return res == 1 ? 1 : EOF;
    307309}
Note: See TracChangeset for help on using the changeset viewer.