binary data files

Leslie Mikesell les at chinet.chi.il.us
Sun May 7 15:16:52 AEST 1989


In article <1821 at ubu.warwick.UUCP> geoff at cs.warwick.ac.uk (Geoff Rimmer) writes:

>My "rules" for choosing whether I use a binary file, or an ASCII file
>for storing data are as follows:

>(1)	If I am storing a file of structs, I always use binary.  This
>is because it is faster, and because it makes the code easier to write
>and understand.

[...]
>I don't believe you can say "always use ascii files" - it just ain't
>good enough for some applications.

I'm surprised that no one has mentioned this yet, but writing binary data
or structs to disk files results in a file which may require conversion
for use by another machine.  This becomes a serious problem in a networked
environment where it may not be apparent which machine created the file
or when multiple machines need simultaneous access.  It is not that
unlikely that your next machine upgrade will consist of adding more hosts
on a net with access to the current files.  Do you want to bet that they
will have the same byte order, word size, and struct padding?

Les Mikesell



More information about the Comp.lang.c mailing list