delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/06/17/08:57:05

From: papilla AT cs DOT tamu DOT edu (Benoit Papillault)
Subject: Re: Fseek Help?
17 Jun 1998 08:57:05 -0700 :
Message-ID: <Pine.GSO.3.96.980617023341.3012A-100000.cygnus.gnu-win32@swallow>
References: <199806160527 DOT WAA119358 AT axon DOT engr DOT sgi DOT com>
Mime-Version: 1.0
To: Christopher Donham <donham AT axon DOT engr DOT sgi DOT com>
Cc: gnu-win32 AT cygnus DOT com

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
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019