Article View: comp.bugs.4bsd
Article #1340Re: ungetc will put characters back into an _IOSTRG input stream
From: Jack Jansen
Date: Mon, 13 Feb 1989 23:10
Date: Mon, 13 Feb 1989 23:10
12 lines
889 bytes
889 bytes
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@cwi.nl Destroy power, not people! -- Crass | (or mcvax!jack)
Technical Details
Message-ID:
<7898@boring.cwi.nl>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!itsgw!steinmetz!uunet!mcvax!jackReferences:
<20282@lll-winken.LLNL.GOV>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!itsgw!steinmetz!uunet!mcvax!jack From: jack@cwi.nl (Jack Jansen) Newsgroups: comp.bugs.4bsd Subject: Re: ungetc will put characters back into an _IOSTRG input stream Keywords: writable strings, shared strings (text segment), sscanf, ungetc Message-ID: <7898@boring.cwi.nl> Date: 13 Feb 89 23:10:12 GMT References: <20282@lll-winken.LLNL.GOV> Sender: news@cwi.nl Organization: AMOEBA project, CWI, Amsterdam Lines: 12