www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/04/08/18:42:07

From: Alain Magloire <alainm AT rcsm DOT ece DOT mcgill DOT ca>
Message-Id: <199904082241.SAA27805@mccoy2.ECE.McGill.CA>
Subject: Re: fflush question
To: djgpp-workers AT delorie DOT com
Date: Thu, 8 Apr 1999 18:41:48 -0400 (EDT)
In-Reply-To: <370D1E26.F953128@cartsys.com> from "Nate Eldredge" at Apr 8, 99 02:22:46 pm
X-Mailer: ELM [version 2.4 PL25]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Bonjour 

> Here's some weird results.  I used the same test program, slightly
> modified:
> 
> test1.c: no fsync
> 
> #include <stdio.h>
> 
> main()
> {
....
>   else
> 	  printf("i=%d\n");
          ^^^^^^^^^^^^^^^^^^^^^
> }

an argument is missing in your test.

> test2.c: with fsync
> 
> #include <stdio.h>
> #include <unistd.h>
> main()
> {
...
>   fscanf(b, "%d", &i);
>   if (fscanf(b, "%d", &i) < 1)

Two fscanf () ??

> 	  printf("fscanf failed\n");
>   else
> 	  printf("i=%d\n");
> }
> 
> 
....
> So do these systems have serious bugs in scanf, or is there a subtle bug
> in the test that I missed?

Yes. In your second test your doing 2 fscanf(), and the printf()
is missing an argument.  I run this On Solaris, QNX, SunOS with
no problems .i.e no need for fsync().

-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!

- Raw text -


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