If you write data to a binary stream processed one record at a time, and the product of size and count (parameters of fwrite()) is greater than the record length, then only the data that fits in the current record is written and errno is set to ETRUNC.
If the product of size and count is less than the actual record length, the current record is padded with blank characters and errno is set to EPAD.
Figure 98. Writing to a Binary Stream File One Record at a Time
Only fwrite() is valid for writing to binary stream files opened for record-at-a-time processing. All other output and positioning functions fail, and errno is set to ERECIO.
Example:
The following example illustrates how to write to a binary stream file by record.
Figure 99. ILE C Source to Write to a Binary Stream File by Record
|
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.