📄 iostream.h
字号:
}
return do_sputn(_s, _n);
}
inline int _Cdecl streambuf::sgetn(char _FAR * _s, int _n) {
if( _n <= (egptr_ - gptr_) ) {
memcpy(_s, gptr_, _n);
gbump(_n);
return _n;
}
return do_sgetn(_s, _n);
}
#endif
class _CLASSTYPE istream : virtual public ios {
public:
// constructor and destructor
_Cdecl istream(streambuf _FAR *);
virtual _Cdecl ~istream();
// Obsolete constructors, for streams 1.2 compatibility
// obsolete: set skip via format, tie via tie() function
_Cdecl istream(streambuf _FAR *, int _sk, ostream _FAR * _t=0);
// obsolete: use strstream
_Cdecl istream(int _sz, char _FAR *, int _sk=1);
// obsolete: use fstream
_Cdecl istream(int _fd, int _sk=1, ostream _FAR * _t=0);
int _Cdecl ipfx(int = 0); // input prefix function
int _Cdecl ipfx0(); // same as ipfx(0)
int _Cdecl ipfx1(); // same as ipfx(1)
void _Cdecl isfx() { } // unused input suffix function
// set/read the get pointer's position
istream _FAR & _Cdecl seekg(streampos);
istream _FAR & _Cdecl seekg(streamoff, ios::seek_dir);
streampos _Cdecl tellg();
int _Cdecl sync();
/*
* Unformatted extraction operations
*/
// extract characters into an array
istream _FAR & _Cdecl get( signed char _FAR *, int, char = '\n');
istream _FAR & _Cdecl get(unsigned char _FAR *, int, char = '\n');
istream _FAR & _Cdecl read( signed char _FAR *, int);
istream _FAR & _Cdecl read(unsigned char _FAR *, int);
// extract characters into an array up to termination char
istream _FAR & _Cdecl getline( signed char _FAR *, int, char = '\n');
istream _FAR & _Cdecl getline(unsigned char _FAR *, int, char = '\n');
// extract characters into a streambuf up to termination char
istream _FAR & _Cdecl get(streambuf _FAR &, char = '\n');
// extract a single character
istream _FAR & _Cdecl get(unsigned char _FAR &);
istream _FAR & _Cdecl get( signed char _FAR &);
int _Cdecl get();
int _Cdecl peek(); // return next char without extraction
int _Cdecl gcount(); // number of unformatted chars last extracted
istream _FAR & _Cdecl putback(char); // push back char into input
// extract and discard chars but stop at delim
istream _FAR & _Cdecl ignore(int = 1, int = EOF);
/*
* Formatted extraction operations
*/
istream _FAR & _Cdecl operator>> (istream _FAR & (_Cdecl *_f)(istream _FAR &));
istream _FAR & _Cdecl operator>> (ios _FAR & (_Cdecl *_f)(ios _FAR &) );
istream _FAR & _Cdecl operator>> ( signed char _FAR *);
istream _FAR & _Cdecl operator>> (unsigned char _FAR *);
istream _FAR & _Cdecl operator>> (unsigned char _FAR &);
istream _FAR & _Cdecl operator>> ( signed char _FAR &);
istream _FAR & _Cdecl operator>> (short _FAR &);
istream _FAR & _Cdecl operator>> (int _FAR &);
istream _FAR & _Cdecl operator>> (long _FAR &);
istream _FAR & _Cdecl operator>> (unsigned short _FAR &);
istream _FAR & _Cdecl operator>> (unsigned int _FAR &);
istream _FAR & _Cdecl operator>> (unsigned long _FAR &);
istream _FAR & _Cdecl operator>> (float _FAR &);
istream _FAR & _Cdecl operator>> (double _FAR &);
istream _FAR & _Cdecl operator>> (long double _FAR &);
// extract from this istream, insert into streambuf
istream _FAR & _Cdecl operator>> (streambuf _FAR *);
protected:
_Cdecl istream();
void _Cdecl eatwhite(); // extract consecutive whitespace
private:
int gcount_; // chars extracted by last unformatted operation
signed char _Cdecl do_get(); // implementation of get
};
inline int _Cdecl istream::gcount() { return gcount_; }
inline int _Cdecl istream::ipfx0() { return ipfx(0); }
inline int _Cdecl istream::ipfx1() { return ipfx(1); }
#ifdef _BIG_INLINE_
inline istream _FAR & _Cdecl istream::operator>> (unsigned char _FAR & _c) {
if( ipfx0() )
_c = bp->in_avail() ? bp->sbumpc() : do_get();
return *this;
}
inline istream _FAR & _Cdecl istream::operator>> (signed char _FAR & _c) {
if( ipfx0() )
_c = bp->in_avail() ? bp->sbumpc() : do_get();
return *this;
}
#endif
inline istream _FAR & _Cdecl istream::operator>> (unsigned char _FAR *_p) {
return *this >> (signed char _FAR *)_p;
}
inline istream _FAR & _Cdecl istream::get(unsigned char _FAR *_p, int _l, char _t) {
return get((signed char _FAR *)_p, _l, _t);
}
inline istream _FAR & _Cdecl istream::read(unsigned char _FAR *_p, int _l) {
return read((signed char _FAR *)_p, _l);
}
inline istream _FAR & _Cdecl istream::getline(unsigned char _FAR *_p, int _l, char _t) {
return getline((signed char _FAR *) _p, _l, _t);
}
inline int _Cdecl istream::sync() { return bp->sync(); }
inline istream _FAR & _Cdecl istream::operator>> (istream _FAR & (_Cdecl *_f)(istream _FAR &)) {
return (*_f)(*this);
}
#ifdef _BIG_INLINE_
inline istream _FAR & _Cdecl istream::get(unsigned char _FAR & _c) {
if( ipfx1() )
if( bp->in_avail() ) {
gcount_ = 1;
_c = bp->sbumpc();
}
else _c = do_get();
return *this;
}
inline istream _FAR & _Cdecl istream::get(signed char _FAR & _c) {
if( ipfx1() )
if( bp->in_avail()) {
gcount_ = 1;
_c = bp->sbumpc();
}
else _c = do_get();
return *this;
}
inline int _Cdecl istream::get() {
if( ipfx1() ) {
int _c = bp->sbumpc();
if( _c == EOF ) setstate(eofbit);
else gcount_ = 1;
return _c;
}
else return EOF;
}
#endif
inline int _Cdecl istream::peek() { return ipfx1() ? bp->sgetc() : EOF; }
class _CLASSTYPE ostream : virtual public ios {
public:
// constructors and destructor
_Cdecl ostream(streambuf _FAR *);
virtual _Cdecl ~ostream();
// Obsolete constructors, for streams 1.2 compatibility
_Cdecl ostream(int _fd); // obsolete, use fstream
_Cdecl ostream(int _sz, char _FAR *); // obsolete, use strstream
int _Cdecl opfx(); // output prefix function
void _Cdecl osfx(); // output suffix function
ostream _FAR & _Cdecl flush();
// set/read the put pointer's position
ostream _FAR & _Cdecl seekp(streampos);
ostream _FAR & _Cdecl seekp(streamoff, ios::seek_dir);
streampos _Cdecl tellp();
/*
* Unformatted insertion operations
*/
ostream _FAR & _Cdecl put(char); // insert the character
ostream _FAR & _Cdecl write(const signed char _FAR *, int); // insert the string
ostream _FAR & _Cdecl write(const unsigned char _FAR *, int); // insert the string
/*
* Formatted insertion operations
*/
// insert the character
ostream _FAR & _Cdecl operator<< ( signed char);
ostream _FAR & _Cdecl operator<< (unsigned char);
// for the following, insert character representation of numeric value
ostream _FAR & _Cdecl operator<< (short);
ostream _FAR & _Cdecl operator<< (unsigned short);
ostream _FAR & _Cdecl operator<< (int);
ostream _FAR & _Cdecl operator<< (unsigned int);
ostream _FAR & _Cdecl operator<< (long);
ostream _FAR & _Cdecl operator<< (unsigned long);
ostream _FAR & _Cdecl operator<< (float);
ostream _FAR & _Cdecl operator<< (double);
ostream _FAR & _Cdecl operator<< (long double);
// insert the null-terminated string
ostream _FAR & _Cdecl operator<< (const signed char _FAR *);
ostream _FAR & _Cdecl operator<< (const unsigned char _FAR *);
// insert character representation of the value of the pointer
ostream _FAR & _Cdecl operator<< (void _FAR *);
// extract from streambuf, insert into this ostream
ostream _FAR & _Cdecl operator<< (streambuf _FAR *);
// manipulators
ostream _FAR & _Cdecl operator<< (ostream _FAR & (_Cdecl *_f)(ostream _FAR &));
ostream _FAR & _Cdecl operator<< (ios _FAR & (_Cdecl *_f)(ios _FAR &));
protected:
int _Cdecl do_opfx(); // implementation of opfx
void _Cdecl do_osfx(); // implementation of osfx
_Cdecl ostream();
private:
void _Cdecl outstr(const signed char _FAR *, const signed char _FAR *);
};
inline int _Cdecl ostream::opfx() { return ospecial ? do_opfx() : 1; }
inline void _Cdecl ostream::osfx() { if( x_flags & (stdio | unitbuf) ) do_osfx(); }
#ifdef _BIG_INLINE_
inline ostream _FAR & _Cdecl ostream::operator<< (signed char _c) {
if( opfx() )
if( bp->sputc(_c) == EOF ) setstate(badbit);
osfx();
return *this;
}
#endif
inline ostream _FAR & _Cdecl ostream::operator<< (unsigned char _c) {
return *this << (signed char)_c;
}
inline ostream _FAR & _Cdecl ostream::operator<< (const signed char _FAR * _s) {
outstr(_s, (const signed char _FAR *)0);
return *this;
}
inline ostream _FAR & _Cdecl ostream::operator<< (const unsigned char _FAR * _s) {
outstr((const signed char _FAR *)_s, (const signed char _FAR *)0);
return *this;
}
inline ostream _FAR & _Cdecl ostream::operator<< (short _i)
{ return *this << (long) _i; }
inline ostream _FAR & _Cdecl ostream::operator<< (unsigned short _i)
{ return *this << (unsigned long) _i; }
inline ostream _FAR & _Cdecl ostream::operator<< (int _i)
{ return *this << (long) _i; }
inline ostream _FAR & _Cdecl ostream::operator<< (unsigned int _i)
{ return *this << (unsigned long) _i; }
inline ostream _FAR & _Cdecl ostream::operator<< (float _f)
{ return *this << (long double) _f; }
inline ostream _FAR & _Cdecl ostream::operator<< (double _d)
{ return *this << (long double) _d; }
inline ostream _FAR & _Cdecl ostream::operator<< (ostream _FAR & (_Cdecl *_f)(ostream _FAR &))
{ return (*_f)(*this); }
inline ostream _FAR & _Cdecl ostream::write(const unsigned char _FAR * _s, int _n)
{ return write((const signed char _FAR *)_s, _n); }
inline ostream _FAR & _Cdecl ostream::put(char _c) {
if( bp->sputc(_c) == EOF ) setstate(badbit);
return *this;
}
#ifdef _BIG_INLINE_
inline ostream _FAR & _Cdecl ostream::write(const signed char _FAR * _s, int _n) {
if( ! fail() )
if( bp->sputn((const char _FAR *)_s, _n) != _n )
setstate(badbit);
return *this;
}
#endif
class _CLASSTYPE iostream : public istream, public ostream {
public:
_Cdecl iostream(streambuf _FAR *);
virtual _Cdecl ~iostream();
protected:
_Cdecl iostream();
};
class _CLASSTYPE istream_withassign : public istream {
public:
// does no initialization
_Cdecl istream_withassign();
virtual _Cdecl ~istream_withassign();
// gets buffer from istream and does entire initialization
istream_withassign _FAR & _Cdecl operator= (istream _FAR &);
// associates streambuf with stream and does entire initialization
istream_withassign _FAR & _Cdecl operator= (streambuf _FAR *);
};
class _CLASSTYPE ostream_withassign : public ostream {
public:
// does no initialization
_Cdecl ostream_withassign();
virtual _Cdecl ~ostream_withassign();
// gets buffer from istream and does entire initialization
ostream_withassign _FAR & _Cdecl operator= (ostream _FAR &);
// associates streambuf with stream and does entire initialization
ostream_withassign _FAR & _Cdecl operator= (streambuf _FAR *);
};
class _CLASSTYPE iostream_withassign : public iostream {
public:
// does no initialization
_Cdecl iostream_withassign();
virtual _Cdecl ~iostream_withassign();
// gets buffer from stream and does entire initialization
iostream_withassign _FAR & _Cdecl operator= (ios _FAR &);
// associates streambuf with stream and does entire initialization
iostream_withassign _FAR & _Cdecl operator= (streambuf _FAR *);
};
/*
* The predefined streams
*/
extern istream_withassign _Cdecl cin;
extern ostream_withassign _Cdecl cout;
extern ostream_withassign _Cdecl cerr;
extern ostream_withassign _Cdecl clog;
/*
* Manipulators
*/
ostream _FAR & _Cdecl endl(ostream _FAR &); // insert newline and flush
ostream _FAR & _Cdecl ends(ostream _FAR &); // insert null to terminate string
ostream _FAR & _Cdecl flush(ostream _FAR &);// flush the ostream
ios _FAR & _Cdecl dec(ios _FAR &); // set conversion base to decimal
ios _FAR & _Cdecl hex(ios _FAR &); // set conversion base to hexadecimal
ios _FAR & _Cdecl oct(ios _FAR &); // set conversion base to octal
istream _FAR & _Cdecl ws(istream _FAR &); // extract whitespace characters
/*
* Initialization call for Easy Windows
*/
extern "C" void _Cdecl _InitEasyWin(void);
#pragma option -Vo.
#if defined(__BCOPT__)
#pragma option -po.
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -