ungetc will put characters back into an _IOSTRG input stream

Jack Jansen jack at cwi.nl
Tue Feb 14 09:10:12 AEST 1989


I ran into this problem as well, some time ago.

My fix was to have ungetc() only push the character back if it
isn't there already, i.e.
	if( *--fp->_ptr != ch )
		*fp->_ptr = ch;
Makes sscanf work with read-only strings, and still keeps the
semantics the same.
-- 
--
Fight war, not wars			| Jack Jansen, jack at cwi.nl
Destroy power, not people! -- Crass	| (or mcvax!jack)



More information about the Comp.bugs.4bsd.ucb-fixes mailing list