Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Christopher Curtis <ccurtis@ee.fit.edu>
To: axp-list@redhat.com
Subject: Re: Problem with binary file I/O
Date: Sun, 26 Apr 1998 22:49:43 -0400 (EDT)	[thread overview]
Message-ID: <Pine.GSO.3.96.980426224413.23553B-100000@yacht.ee.fit.edu> (raw)
In-Reply-To: <199804270056.SAA02075@walleye.gonefishing.sk.ca>

On Sun, 26 Apr 1998, Larry Zimmerman wrote:

> When I use the "high-level" file I/O functions, the program fails.
> When I use the "low-level" functions, the program works.
[...]
> no-one believes me, or maybe no-one knows how to fix it!

This seems unlikely...

> I wrote a test program to demonstrate the problem - see link below -
> and have discovered the following:
[...]
> I have a web page with more details and the sample program at:
> http://walleye.gonefishing.sk.ca/laz/rdwr/problem.html

I looked at the .c file you have at this link and the problem seems pretty
simple.  Maybe that's why nobody answered, or maybe everyone's working on
the Netscape code.  Anyhow, on pages 11 and 13 (of 22 - you do the math)
you have two fopen calls, each opening the file in "a+" mode.  In this
mode, fseek()s will work and you can read data from any position, but all
data written will ALWAYS be written to the end of the file.  This is
'append' mode and was created specifically for logging facilities.  You
want to use mode "w+" (read/write) and don't worry, it won't destroy your
ouput file like the plain old "w"-mode.

> I would appreciate any advice or help to solve this problem.

--
Christopher Curtis               - http://www.ee.fit.edu/users/ccurtis
Florida Institute of Technology  - System Administrator, Programmer
Melbourne, Florida  USA          - http://www.lp.org/


  reply	other threads:[~1998-04-27  2:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-27  0:56 Problem with binary file I/O Larry Zimmerman
1998-04-27  2:49 ` Christopher Curtis [this message]
     [not found] <ccurtis@ee.fit.edu>
1998-04-27  3:37 ` Larry Zimmerman
1998-04-27  3:43   ` Christopher Curtis
1998-04-27  4:02 ` Larry Zimmerman
1998-04-27  4:26   ` Christopher Curtis
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox