[comp.os.vms] Warning on fwrite C function

STEINBERGER@KL.SRI.COM.UUCP (09/18/87)

In an earlier message I asked a question about reading/writing binary files
from VAX C.  After two calls to the DEC CSS, I have found that the description
of the arguments to fwrite is not appropriate if one is trying to write a
single binary record to a (fixed record size) file opened with the "wb"
attribute.  The VAX C RTL Ref Man states that the second and third arguments
to fwrite are number of items and size of item.  This may work for writing to
non-binary files.  To write one record, the second argument should be the
total size in bytes (and equal the record size used in the "mrs=rec_size"
argument of fopen), and the third argument should equal 1.
    The fread function works as advertised on binary files.

-Ric Steinberger
Steinberger@kl.sri.com

-------