istream& istream::ignore(int n /* = 1 */, int delim /* = EOF */) { if (ipfx1()) { register streambuf* sb = _strbuf; if (delim == EOF) { _gcount = sb->ignore(n); return *this; } _gcount = 0; for (;;) { #if 0 if (n != MAXINT) // FIXME #endif if (--n < 0) break; int ch = sb->sbumpc(); if (ch == EOF) { set(ios::eofbit|ios::failbit); break; } _gcount++; if (ch == delim) break; } } return *this; }
istream& istream::read(char *s, int n) { if (ipfx1()) { _gcount = _strbuf->sgetn(s, n); if (_gcount != n) set(ios::failbit); } return *this; }
istream& istream::get(char& c) { if (ipfx1()) { int ch = _strbuf->sbumpc(); if (ch == EOF) set(ios::eofbit|ios::failbit); else c = (char)ch; } return *this; }
istream &istream::get( char &ch ) { __lock_it( __i_lock ); if( ipfx1() ) { if( rdbuf()->in_avail() ) { ch = (char)(rdbuf()->sgetchar()); } else { do_get( ch ); } isfx(); } else { __last_read_length = 0; } return( *this ); }
istream &istream::read( char *buf, int len ) { __lock_it( __i_lock ); if( ipfx1() ) { if( rdbuf()->in_avail() > len ) { __last_read_length = rdbuf()->sgetn( buf, len ); } else { do_read( buf , len ); } isfx(); } else { __last_read_length = 0; } return( *this ); }
int istream::get() { if( ipfx1() ) { int c = bp->sbumpc(); if( c == EOF ) setstate(ios::eofbit); else gcount_ = 1; return c; } else return EOF; }
istream _FAR & istream::get(signed char _FAR & c) { if( ipfx1() ) { if( bp->in_avail()) { gcount_ = 1; c = bp->sbumpc(); } else c = do_get(); } else setstate(ios::failbit); return *this; }
istream _FAR & istream::ignore(int n, int d) { if( ipfx1() ) { int c = 0; while( --n >= 0 && (c = bp->sgetc()) != EOF ) { ++gcount_; bp->stossc(); if( c == d ) break; // we DO consume the delimiter } if( c == EOF ) setstate(ios::eofbit); } return *this; }
istream _FAR & istream::get(streambuf _FAR & s, char d) { if( ipfx1() ) { int c; int err = 0; while( (c = bp->sgetc()) != d && c != EOF ) { if( s.sputc(c) == EOF ) { err = 1; break; } ++gcount_; bp->stossc(); } if( c == EOF ) setstate(ios::eofbit); if( err ) setstate(ios::failbit); } return *this; }
int peek() { if (!ipfx1()) return (-1) ; int ch = _strbuf->sgetc(); if (ch == (-1) ) set(ios::eofbit); return ch; }
int get() { if (!ipfx1()) return (-1) ; int ch = _strbuf->sbumpc(); if (ch == (-1) ) set(ios::eofbit); return ch; }