Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!VENUS.YCC.YALE.EDU!LEICHTER
From: LEICHTER@VENUS.YCC.YALE.EDU ("Jerry Leichter ", LEICHTER-JERRY@CS.YALE.EDU)
Newsgroups: comp.os.vms
Subject: re: VAX C: problem with ungetc()
Message-ID: <8807061402.AA28795@ucbvax.Berkeley.EDU>
Date: 4 Jul 88 14:16:00 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 28


	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