⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iostream.h

📁 tc3.0,turbo c开发平台(turb0 c 3.0)kaifapingtai
💻 H
📖 第 1 页 / 共 2 页
字号:
	    		return do_sgetn(_s, _n);
		        }
#endif


class istream : virtual public ios {
public:
	// constructor and destructor
		_Cdecl istream(streambuf*);
virtual	_Cdecl ~istream();

	// Obsolete constructors, for streams 1.2 compatibility
		// obsolete: set skip via format, tie via tie() function
		_Cdecl istream(streambuf*, int _sk, ostream* _t=0);
		// obsolete: use strstream
		_Cdecl istream(int _sz, char*, int _sk=1);
		// obsolete: use fstream
		_Cdecl istream(int _fd, int _sk=1, ostream* _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& _Cdecl seekg(streampos);
	istream& _Cdecl seekg(streamoff, seek_dir);
   	streampos _Cdecl tellg();

	int	_Cdecl sync();

	/*
	 * Unformatted extraction operations
	 */
	// extract characters into an array
	istream& _Cdecl get(  signed char*, int, char = '\n');
	istream& _Cdecl get(unsigned char*, int, char = '\n');
	istream& _Cdecl read(  signed char*, int);
	istream& _Cdecl read(unsigned char*, int);

	// extract characters into an array up to termination char
	istream& _Cdecl getline(  signed char*, int, char = '\n');
	istream& _Cdecl getline(unsigned char*, int, char = '\n');

	// extract characters into a streambuf up to termination char
	istream& _Cdecl get(streambuf&, char = '\n');

	// extract a single character
	istream& _Cdecl get(unsigned char&);
	istream& _Cdecl get(  signed char&);
	int 	 _Cdecl get();
                     
	int	     _Cdecl peek();		// return next char without extraction
	int	     _Cdecl gcount();	// number of unformatted chars last extracted
	istream& _Cdecl putback(char);	// push back char into input

	// extract and discard chars but stop at delim
	istream& _Cdecl ignore(int = 1, int = EOF);

	/*
	 * Formatted extraction operations
	 */
	istream& _Cdecl operator>> (istream& (*_f)(istream&));
	istream& _Cdecl operator>> (ios& (*_f)(ios&) );
	istream& _Cdecl operator>> (  signed char*);
	istream& _Cdecl operator>> (unsigned char*);
	istream& _Cdecl operator>> (unsigned char&);
	istream& _Cdecl operator>> (  signed char&);
	istream& _Cdecl operator>> (short&);
	istream& _Cdecl operator>> (int&);
	istream& _Cdecl operator>> (long&);
	istream& _Cdecl operator>> (unsigned short&);
	istream& _Cdecl operator>> (unsigned int&);
	istream& _Cdecl operator>> (unsigned long&);
	istream& _Cdecl operator>> (float&);
	istream& _Cdecl operator>> (double&);
	istream& _Cdecl operator>> (long double&);

	// extract from this istream, insert into streambuf
	istream& _Cdecl operator>> (streambuf*);

protected:
		    _Cdecl istream();
	int	    _Cdecl do_ipfx(int);	// implementation of ipfx
	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::ipfx(int _need) {
    			if( _need ? (ispecial & ~skipping) : ispecial )
	    			return do_ipfx(_need);
		    	return 1;
        		}
inline int	_Cdecl istream::ipfx0() { return ispecial ? do_ipfx(0) : 1; }
inline int	_Cdecl istream::ipfx1() {
    			return (ispecial & ~skipping) ? do_ipfx(1) : 1;
	        	}
#ifdef _BIG_INLINE_
inline istream& _Cdecl istream::operator>> (unsigned char& _c) {
        		if( ipfx0() )
		    		_c = bp->in_avail() ? bp->sbumpc() : do_get();
			    return *this;
        		}
inline istream& _Cdecl istream::operator>> (signed char& _c) {
    			if( ipfx0() )
	    			_c = bp->in_avail() ? bp->sbumpc() : do_get();
		    	return *this;
        		}
#endif
inline istream&	_Cdecl istream::operator>> (unsigned char* _p) {
    			return *this >> (signed char *)_p;
	        	}
inline istream&	_Cdecl istream::get(unsigned char* _p, int _l, char _t) {
    			return get((signed char*)_p, _l, _t);
	        	}
inline istream&	_Cdecl istream::read(unsigned char* _p, int _l) {
    			return read((signed char*)_p, _l);
	        	}
inline istream&	_Cdecl istream::getline(unsigned char* _p, int _l, char _t) {
    			return getline((signed char*) _p, _l, _t);
	        	}
inline int	    _Cdecl istream::sync() { return bp->sync(); }
inline istream& _Cdecl istream::operator>> (istream& (*_f) (istream&)) {
    			return (*_f)(*this);
	        	}
#ifdef _BIG_INLINE_
inline istream& _Cdecl istream::get(unsigned char& _c) {
    			if( ipfx1() )
	    			if( bp->in_avail() ) {
		    			gcount_ = 1;
			    		_c = bp->sbumpc();
				    }
				else _c = do_get();
    			return *this;
	        	}
inline istream& _Cdecl istream::get(signed char& _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 ostream : virtual public ios {
public:
	// constructors and destructor
		_Cdecl ostream(streambuf*);
virtual	_Cdecl ~ostream();
	// Obsolete constructors, for streams 1.2 compatibility
		_Cdecl ostream(int _fd); // obsolete, use fstream
		_Cdecl ostream(int _sz, char*); // obsolete, use strstream

	int	_Cdecl opfx();		// output prefix function
	void _Cdecl osfx();		// output suffix function
	ostream& _Cdecl flush();

	// set/read the put pointer's position
	ostream& _Cdecl seekp(streampos);
	ostream& _Cdecl seekp(streamoff, seek_dir);
 	streampos _Cdecl tellp();

	/*
	 * Unformatted insertion operations
	 */
	ostream& _Cdecl put(char);	// insert the character
	ostream& _Cdecl write(const   signed char*, int); // insert the string
	ostream& _Cdecl write(const unsigned char*, int); // insert the string

	/*
	 * Formatted insertion operations
	 */
	// insert the character
	ostream& _Cdecl operator<< (  signed char);
	ostream& _Cdecl operator<< (unsigned char);

	// for the following, insert character representation of numeric value
	ostream& _Cdecl operator<< (short);
	ostream& _Cdecl operator<< (unsigned short);
	ostream& _Cdecl operator<< (int);
	ostream& _Cdecl operator<< (unsigned int);
	ostream& _Cdecl operator<< (long);
	ostream& _Cdecl operator<< (unsigned long);
	ostream& _Cdecl operator<< (float);
	ostream& _Cdecl operator<< (double);
	ostream& _Cdecl operator<< (long double);

	// insert the null-terminated string
	ostream& _Cdecl operator<< (const   signed char*);
	ostream& _Cdecl operator<< (const unsigned char*);

	// insert character representation of the value of the pointer
	ostream& _Cdecl operator<< (void*);

	// extract from streambuf, insert into this ostream
	ostream& _Cdecl operator<< (streambuf*);

	// manipulators
	ostream& _Cdecl operator<< (ostream& (*_f)(ostream&));
	ostream& _Cdecl operator<< (ios& (*_f)(ios&));

protected:
	int	    _Cdecl do_opfx();	// implementation of opfx
	void	_Cdecl do_osfx();	// implementation of osfx
		    _Cdecl ostream();

private:
	void	_Cdecl outstr(const char*, const char*);
};
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& _Cdecl ostream::operator<< (signed char _c) {
    			if( opfx() )
	    			if( bp->sputc(_c) == EOF ) setstate(badbit);
		            	osfx();
    			return *this;
	        	}
#endif
inline ostream& _Cdecl ostream::operator<< (unsigned char _c) {
    			return *this << (signed char)_c;
	        	}
inline ostream& _Cdecl ostream::operator<< (const signed char* _s) {
    			outstr((const char*)_s, (const char*)0);
	    		return *this;
		        }
inline ostream& _Cdecl ostream::operator<< (const unsigned char* _s) {
    			outstr((const char*)_s, (const char*)0);
	    		return *this;
		        }
inline ostream& _Cdecl ostream::operator<< (short _i) { return *this << (long) _i; }
inline ostream& _Cdecl ostream::operator<< (unsigned short _i) {
    			return *this << (unsigned long) _i;
	        	}
inline ostream& _Cdecl ostream::operator<< (int _i) { return *this << (long) _i; }
inline ostream& _Cdecl ostream::operator<< (unsigned int _i) {
    			return *this << (unsigned long) _i;
	        	}
inline ostream& _Cdecl ostream::operator<< (float _f) { return *this << (long double) _f; }
inline ostream& _Cdecl ostream::operator<< (double _d) { return *this << (long double) _d; }
inline ostream& _Cdecl ostream::operator<< (ostream& (*_f)(ostream&)) {
    			return (*_f)(*this);
	        	}
inline ostream& _Cdecl ostream::write(const unsigned char* _s, int _n) {
    			return write((const signed char*)_s, _n);
	        	}
inline ostream& _Cdecl ostream::put(char _c) {
    			if( bp->sputc(_c) == EOF ) setstate(badbit);
	    		return *this;
		        }
#ifdef _BIG_INLINE_
inline ostream& _Cdecl ostream::write(const signed char* _s, int _n) {
    			if( ! fail() )
	    			if( bp->sputn((const char*)_s, _n) != _n )
		    			setstate(badbit);
			    return *this;
        		}
#endif


class iostream : public istream, public ostream {
public:
		_Cdecl iostream(streambuf*);
virtual	_Cdecl ~iostream();

protected:
		_Cdecl iostream();
};


class 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& _Cdecl operator= (istream&);

	// associates streambuf with stream and does entire initialization
	istream_withassign& _Cdecl operator= (streambuf*);
};


class 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& _Cdecl operator= (ostream&);

	// associates streambuf with stream and does entire initialization
	ostream_withassign& _Cdecl operator= (streambuf*);
};


class 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& _Cdecl operator= (ios&);

	// associates streambuf with stream and does entire initialization
	iostream_withassign& _Cdecl operator= (streambuf*);
};


/*
 * 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& _Cdecl endl(ostream&);	// insert newline and flush
ostream& _Cdecl ends(ostream&);	// insert null to terminate string
ostream& _Cdecl flush(ostream&);// flush the ostream
ios&	 _Cdecl dec(ios&);		// set conversion base to decimal
ios&	 _Cdecl hex(ios&);		// set conversion base to hexidecimal
ios&	 _Cdecl oct(ios&);		// set conversion base to octal
istream& _Cdecl ws(istream&);	// extract whitespace characters

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -