Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

basic_istream


basic_istreaminherits frombasic_iosinherits fromios_base

Summary

Assists in reading and interpreting input from sequences controlled by a stream buffer.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <istream>
template<class charT, class traits = char_traits<charT> >
class basic_istream 
: virtual public basic_ios<charT, traits>

Description

The class basic_istream defines member functions that assist in reading and interpreting input from sequences controlled by a stream buffer.

Two groups of member function signatures share common properties: the formatted input functions (or extractors) and the unformatted input functions. Both groups of input functions obtain (or extract) input characters from basic_streambuf. They both begin by constructing an object of class basic_istream::sentry and, if this object is in good state after construction, the function obtains the requested input. The sentry object performs exception safe initialization, such as controlling the status of the stream or locking it in a multithread environment.

Some formatted input functions parse characters extracted from the input sequence, converting the result to a value of some scalar data type, and storing the converted value in an object of that scalar type. The conversion behavior depends directly on the locale object being imbued in the stream.

Interface

Types

char_type
int_type
ios_type
istream
istream_type
off_type
pos_type
streambuf_type
traits_type
wistream

Public Constructors

explicit basic_istream(basic_streambuf<charT, traits>* sb); 

Public Destructors

virtual ~basic_istream();

Sentry Classes

explicit sentry(basic_istream<charT,traits>&,
                 bool noskipws=0); 
~sentry();
operator bool();

Extractors

istream_type& 
operator>>(istream_type&
          (*pf) (istream_type&));
istream_type& 
operator>>(ios_type& (*pf) (ios_type&));
istream_type& 
operator>>(ios_base& (*pf) (ios_base&));
istream_type& 
operator>>(bool& n); 
istream_type& 
operator>>(short& n);
istream_type& 
operator>>(unsigned short& n);
istream_type& 
operator>>(int& n);
istream_type& 
operator>>(unsigned int& n);
istream_type& 
operator>>(long& n);
istream_type& 
operator>>(unsigned long& n);
istream_type& 
operator>>(float& f);
istream_type&
operator>>(double& f);
istream_type&
operator>>(long double& f);
istream_type&
operator>>(void*& p);
istream_type&
operator>>(streambuf_type* sb);
istream_type&
operator>>(streambuf_type& sb);

Unformatted Functions

streamsize 
gcount() const; 
int_type 
get();
istream_type& 
get(char_type& c);
istream_type& 
get(char_type* s, streamsize n,char_type delim);
istream_type& 
get(char_type* s, streamsize n);
istream_type& 
get(streambuf_type& sb,char_type delim);
istream_type& 
get(streambuf_type& sb);
istream_type& 
getline(char_type* s, streamsize n, char_type delim); 
istream_type& 
getline(char_type* s, streamsize n);
istream_type& 
ignore(streamsize n=1, int_type delim=traits::eof());
int_type 
peek();
istream_type& 
putback(char_type c); 
istream_type& 
read(char_type* s, streamsize n); 
streamsize 
readsome(char_type* s, streamsize n); 
istream_type& 
seekg(pos_type& pos); 
istream_type& 
seekg(off_type& off, ios_base::seekdir dir);
int 
sync();
pos_type 
tellg();
istream_type& 
unget();

Non-member Functions

template<class charT, class traits>
basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, charT& c); 
template<class charT, class traits>
basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, charT* s);
template<class traits>
basic_istream<char, traits>&
operator>>(basic_istream<char, traits>& is, 
            unsigned char& c);
template<class traits>
basic_istream<char, traits>&
operator>>(basic_istream<char, traits>& is, 
           signed char& c);
template<class traits>
basic_istream<char, traits>&
operator>>(basic_istream<char, traits>& is, 
           unsigned char* c);
template<class traits>
basic_istream<char, traits>&
operator>>(basic_istream<char, traits>& is, 
           signed char* c);
template<class charT, class traits>
basic_istream<charT, traits>&
ws(basic_istream<charT, traits>& is); 

Example

See Also

char_traits(3C++), ios_base(3C++), basic_ios(3C++), basic_streambuf(3C++), basic_iostream(3C++)

Working Paper for Draft Proposed International Standard for Information Systems--Programming Language C++, Section 27.6.1

Standards Conformance

ANSI X3J16/ISO WG21 Joint C++ Committee



Previous fileTop of documentContentsIndexNext file
©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998