ungetc/scanf independent?

Larry Jones scjones at sdrc.UUCP
Thu Mar 29 08:08:50 AEST 1990


In article <3009.260C8D7C at puddle.fidonet.org>, cspw.rures at p0.f4.n494.z5.fidonet.org (cspw rures) writes:
> I have a VAX problem when interleaving calls to getc and ungetc with
> calls to scanf.   On all the compilers I tested (except the VAX VMS 4.2),
> and "ungetc" character is available to a subsequent scanf.  On the VAX
> it appears that getc and ungetc have their own private "view" of the file,
> not shared by scanf.
>  
> Is the VAX C compiler broken?   What does ANSI say?

The ANSI standard says that all I/O is done "as if" by calls to
getc and putc.  Thus, if you ungetc a character, it is available
to scanf.

Is the Vax C compiler broken?  Maybe, but that's irrelevant.  The
Vax C Run Time Library definitely is in VMS V4.2!  Since the
library comes with VMS, not with the compiler, and VMS is now up
to V5.3 or so, you're a little behind the times.  I suggest
updating ASAP.
----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                      scjones at SDRC.UU.NET
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150-2789             AT&T: (513) 576-2070
"You know how Einstein got bad grades as a kid?  Well MINE are even WORSE!"
-Calvin



More information about the Comp.lang.c mailing list