Truncation occurred because the specified block length on the write operation was larger than the block buffer size.
The return value depends on the operation attempted. In all cases, the buffer will be written up to the point where truncation occurred.
For a file opened for blocked I/O, specify a smaller number of bytes for fwrite().
EDC54G