binary data files

Bill Poser poser at csli.Stanford.EDU
Mon May 1 12:39:47 AEST 1989


I agree that in many cases it is desirable to use ASCII data files,
but in some situations binary is better. One such situation is when
you need to know how many items are in the file before you read it
(say to allocate storage). If the data is binary you just
stat the file and divide by the item size. But if you use ASCII data
there won't be a fixed item size, unless you go to the trouble of
arranging fixed field widths (which also may waste a lot of space),
or arrange to write a header containing the number of items,
which is impractical in some situations.

 



More information about the Comp.lang.c mailing list