[comp.os.vms] VAX C: problem with ungetc

PFH@CUTHRY.BITNET (06/30/88)

Hi netland,
        Since installing vms v4.6, ungetc() function of VAX C
has been broken.  In particular, a character returned by ungetc()
is ignored in subsequent fscanf() calls.
        Has this plagued anyone else? Is there a simple fix? (e.g
does vms v4.7 fix this?)
        For the record, we are running VAX C v2.4 on vms v4.6 on
a VAX 11/780.  Thanks.
                                Paul Hsieh
                                39 Pupin Physics Lab
                                Columbia University
                                pfh@cuthry.bitnet

LEICHTER@VENUS.YCC.YALE.EDU ("Jerry Leichter ", LEICHTER-JERRY@CS.YALE.EDU) (07/04/88)

	Since installing vms v4.6, ungetc() function of VAX C
	has been broken.  In particular, a character returned by ungetc()
	is ignored in subsequent fscanf() calls.

        Has this plagued anyone else? Is there a simple fix? (e.g
	does vms v4.7 fix this?)

	For the record, we are running VAX C v2.4 on vms v4.6 on
	a VAX 11/780.  Thanks.

Known bug, discussed on this list a while back.  It's really unfortunate that
there is no way to go back and find messages on a given topic!

As you've noted, the connection between ungetc() and fscanf() (and, I think,
fgets()) got broken in the V4.6 version of the library.  Unfortunately, this
was NOT fixed in V4.7 - the V4.6-V4.7 interval was very short, and I gather
the bug report arrived the day after the V4.7 of the library went out the
door.  It IS fixed in V5.0.  If this is a serious problem for you, you might
ask your DEC support person if a special patch is available.

BTW, the ungetc and getc work together just fine.

In case you are wondering what kind of changes could lead to this kind of
problem:  A (since-withdrawn) piece of the proposed ANSI C spec add to the
definition of fflush() that "flushing" an input file would discard any
"ungotten" character.  It was adding this that broke the code.  Sigh.

							-- Jerry