delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/01/23:19:07

From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Possibly bug in fseek()
Date: Tue, 01 Jul 1997 16:01:41 -0400
Organization: Cornell University http://www.cornell.edu
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <33B96225.7E4F@cornell.edu>
References: <5pb9t9$1if$1 AT news-hrz DOT uni-duisburg DOT de>
Reply-To: asu1 AT cornell DOT edu
NNTP-Posting-Host: cu-dialup-0066.cit.cornell.edu
Mime-Version: 1.0
Lines: 48
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Michael Mauch wrote:
> 
> Hi!
> 
> fseek() in DJGPP v2.01 seems to have a bug: it returns 0 for success
> when it should not:
> 
> #include <stdio.h>
> 
> int main(void)
> {
>   FILE* f = fopen("fseekt.c","rb");
> 
>   if(f)
>   {
>     printf("fseek(f,-4096L,SEEK_END)=%d\n",fseek(f,-4096L,SEEK_END));
>     fclose(f);
>   }
> 
>   return 0;
> }

this is what the ANSI standard says (according to an excerpt on p.249 of
Plauger's "The Standard C Library")

7.9.9.2
...
A binary stream need not meaningfully support fseek calls with a whence
value of SEEK_END.
...

Returns:

The fseek function returns nonzero only for a request that cannot be
satisfied.

compare the first line of your post with this information.
-- 
   Sinan
 
*******************************************************************
 A. Sinan Unur                                WWWWWW
                                              |--O+O
 mailto:sinan DOT unur AT cornell DOT edu                C   ^ 
 http://www.people.cornell.edu/pages/asu1/     \  ~/ 

Unsolicited e-mail is _not_ welcome, and will be billed for.
*******************************************************************

- Raw text -


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