Subject: Re: Fseek Help?
From: [email-masked] (Benoit Papillault)

17 Jun 1998 08:57:05 -0700
Message-ID: <Pine.GSO.3.96.980617023341.3012A-100000.cygnus.gnu-win32@swallow>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: Christopher Donham <[email-masked]>
Cc: [email-masked]

On Mon, 15 Jun 1998, Christopher Donham wrote:

> Hi all,
>    A quick question.  I seem to be having trouble getting
> fseek to work.  For some reason after about 900 bytes,
> fseek ceases to go to the correct point in the file. 

It is a usual problem. Your problem is really simple and the solution is
simple too. In fact, when you open your file with fopen(), it is open by
default in TEXT mode. Such mode does not exist under Unix, only under DOS
and Windows. This problem is not related to GNU-Win32 (I already get the
same problem with BC4 under DOS). I understand that the problem seems to
come from nowhere at first...

Solution: Use fopen("file","rb"); to specify explicitely BINARY mode.

You know, this problem is so common that I discover it in my own source
code yesterday. I'm working most of my time in a Unix environnement and we
don't take care about such silly errors. But we can wonder why Microsoft
OS support this silly TEXT mode.

Hope it helps.

Benoit Papillault

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".