Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide

basic_istream

Library:  Input/output


basic_istream basic_ios ios_base

Local Index

Members

Non-Members

Summary

Class that assists in reading and interpreting sequences of characters controlled by a stream buffer

Synopsis

#include <istream>

namespace std {
  template<class charT, class traits = char_traits<charT> >
  class basic_istream;
}

Description

The class basic_istream assists in reading and interpreting sequences of characters controlled by a stream buffer. Two groups of functions share common properties, the formatted functions and the unformatted functions.

Both groups of 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 returns true when converted to bool 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

Member Types

char_type
int_type
off_type
pos_type
traits_type

Nonmember Types

istream
wistream

Constructor

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

Destructor

virtual ~basic_istream();

Class sentry

Interface

Constructor

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

Destructor

~sentry();

Operator

operator bool();

Formatted Input Functions

basic_istream& 
operator>>(basic_istream& (*pf)(basic_istream&));
basic_istream& 
operator>>(basic_ios<charT, traits>& (*pf)(basic_ios<charT,
                                           traits>&));
basic_istream& 
operator>>(ios_base& (*pf)(ios_base&));
basic_istream& 
operator>>(bool& n);
basic_istream& 
operator>>(short& n);
basic_istream& 
operator>>(unsigned short& n);
basic_istream& 
operator>>(int& n);
basic_istream& 
operator>>(unsigned int& n);
basic_istream& 
operator>>(long& n);
basic_istream& 
operator>>(unsigned long& n);
basic_istream& 
operator>>(float& f);
basic_istream& 
operator>>(double& f);
basic_istream& 
operator>>(long double& f);
basic_istream& 
operator>>(void*& p);
basic_istream& 
operator>>(basic_streambuf<charT, traits>* sb);

Unformatted Input Functions

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

Nonmember Formatted Input Functions

template<class charT, class traits>
basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>& is, charT& 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>&
operator>>(basic_istream<charT, traits>& is, charT* s);
template<class traits>
basic_istream<char, traits>&
operator>>(basic_istream<char, traits>& is, unsigned char *s);
template<class traits>
basic_istream<char, traits>&
operator>>(basic_istream<char, traits>& is, signed char *s);
template<class charT, class traits>
basic_istream<charT, traits>&
ws(basic_istream<charT, traits>& is); 

Example

See Also

char_traits, ios_base, basic_ios, basic_streambuf, basic_iostream

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems --Programming Language C++, Section 27.6.1.1



Previous fileTop of DocumentContentsIndex pageNext file