Little problem with sizeof on PC
Mike Percy
grimlok at hubcap.clemson.edu
Fri Apr 26 00:55:00 AEST 1991
c60b-1eq at web-4e.berkeley.edu (Noam Mendelson) writes:
>In article <ENAG.91Apr24175955 at maud.ifi.uio.no> enag at ifi.uio.no (Erik Naggum) writes:
>>In article <1991Apr24.031700.17233 at agate.berkeley.edu>, Noam Mendelson writes:
>>
>> If you want to take up disk space unnecessarily and decrease
>> program performance, sure, you can create ASCII data files.
>> Portability will be limited to the Intel 80x86 line, however, if
>> you opt to use the binary method.
>>
>>If you want to take up debugging time unnecessarily and decrease
>>programmer performance, sure, you can create binary data files.
If I dump structs out to disk and read them back in later, it is a lot
less error prone than coding a bunch of fscanf() calls (which have their
own problems).
>Decrease programmer performance? Read()'ing in the data structure
>causes a lot less headache than trying to fscanf() in the data
>from an ASCII data file.
Unless, of course, you need to try to figure out what's wrong with the
program by examining the data files. But I assume that when I write a
struct to a binary file, I can read it back into the struct. If not,
then my compiler has done me serious wrong...
>>Portability and debug-ability will be be unlimited, however, if you
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>opt to use the readable data file method.
>So I assume you've never had any problems doing I/O on ASCII files.
>ASCII data files produce a whole new set of problems that don't exist
>with the binary format, ranging from the fscanf() syntax to the
>record size.
I sure have.
>Portability will be dramatically increased, although not unlimited.
I suppose protability of the _program_ would be unaffected either way.
The _data_files_, on the other hand, would tend to have problems.
"I don't know about your brain, but mine is really...bossy."
Mike Percy grimlok at hubcap.clemson.edu
ISD, Clemson University mspercy at clemson.BITNET
(803)656-3780 mspercy at clemson.clemson.edu
More information about the Comp.lang.c
mailing list