🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4303

Re: Turbo C fopen()

#4303
From: Steve Resnick
Date: Mon, 21 Jan 1991 17:41
35 lines
1522 bytes
In article <1991Jan21.154432.11941@cbnewsm.att.com> you write:
>
>Hi there people,
>
>	A quick question, I am used to using c programming on a amdahl, but
>	also started working on msdos Turbo-c 1.5. I am having
>problems with reading and writing to a file. I am using a structure of about
>8 to 10 doubles in it.
>
>
>struct empdata {
>	double wages;
>	double	tariff;
>	..
>	..
>
>	double netwages;
>} EmpData;
>
>When I am  writing and reading to a file, a lot of the time I get an fread error
>19 invalid argument. I can figure it out. Does this have something to do
>with using ptr=fopen("DATA","r+b"); . I have never seen  "r+b" before, but maybe
>that is the problem. could somebody explain this r+b and tell me if this is
>my problem.
>

When using fopen(filename,"r+b") you are specifying that the file is to
be opened for reading (and writing), (r specifies read, + specified the 
opposite of the first mode (r)) and b specifies it should be binary rather
than text.  Can you give an example of your fread statement? The fopen
seems to be fine, unless the file doesn't exist.


Cheers!
Steve
Technical Details
Message-ID: <21544@netcom.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cs.utexas.edu!usc!apple!netcom!netcom.UUCP

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cs.utexas.edu!usc!apple!netcom!netcom.UUCP
From: resnicks@netcom.UUCP (Steve Resnick)
Newsgroups: comp.os.msdos.programmer,alt.msdos.programmer
Subject: Re: Turbo C fopen()
Message-ID: <21544@netcom.UUCP>
Date: 21 Jan 91 17:41:15 GMT
Sender: resnicks@netcom.UUCP
Organization: Netcom- The Bay Area's Public Access Unix System {408 241-9760 guest}
Lines: 35