[comp.lang.c] Trouble readn' and writn' in C

usenet@cps3xx.UUCP (Usenet file owner) (06/22/89)

in article <3037@csd4.milw.wisc.edu>, mag2@csd4.milw.wisc.edu (Michael A Gorski) says:
$ I am writing a program in Turbo C 1.5 and am having trouble writing
$ structures to a disk file.
$ When I just do a DOS type file (yes I know it isn't a text file) the char
$ fields in the struct are off by 1. 

Sounds like problems with word aligned data when you want byte aligned
data. Check the manual, there should be a compile line option
to control this.

John H. Lawitzke           UUCP: Work: ...uunet!frith!dale1!jhl
Dale Computer Corp., R&D         Home  ...uunet!frith!ipecac!jhl
2367 Science Parkway       Internet:   jhl@frith.egr.msu.edu
Okemos, MI, 48864                             [35.8.8.108]

cs75jmc@unccvax.UUCP (john m covington) (06/22/89)

In article <3037@csd4.milw.wisc.edu>, mag2@csd4.milw.wisc.edu (Michael A Gorski) writes:
> 
> I am writing a program in Turbo C 1.5 and am having trouble writing
> structures to a disk file.
> 
> Here's what I am doing...
> FILE *fopen(), *ifp();
> struct c s;
                 ^^^^^^^ this should be just *ifp;
                         you have just declared a function named ifp that 
                         returns a pointer to a FILE....

This is not the cause of the problem you are currently experiencing,
just thought I would pass this along, in case you are new to C....

mag2@csd4.milw.wisc.edu (Michael A Gorski) (06/22/89)

In article <1532@unccvax.UUCP> cs75jmc@unccvax.UUCP (john m covington) writes:
>In article <3037@csd4.milw.wisc.edu>, mag2@csd4.milw.wisc.edu (Michael A Gorski) writes:
>> 
>> FILE *fopen(), *ifp();
>                 ^^^^^^^ this should be just *ifp;
>                         you have just declared a function named ifp that 
>                         returns a pointer to a FILE....
>
>This is not the cause of the problem you are currently experiencing,
>just thought I would pass this along, in case you are new to C....

The *ifp() was a typo and not in my source.  Sorry about that.  The
problem was that Turbo C defaults to text mode for files and I just had
to override that make it binary.

Yes I am new to C (This is my first big project) and I'd like to thank
everyone for the help.

  Mike
  mag2@csd4.milw.wisc.edu