get

Syntax:

    int istream::get();
    istream& istream::get( char& ch );
    istream& istream::get( char* buffer, streamsize num );
    istream& istream::get( char* buffer, streamsize num, char delim );
    istream& istream::get( streambuf& buffer );
    istream& istream::get( streambuf& buffer, char delim );

The get() function is used with input streams, and either:

For example, the following code displays the contents of a file called temp.txt, character by character:

     char ch;
     ifstream fin( "temp.txt" );
     while( fin.get(ch) )
       cout << ch;
     fin.close();

Related Topics: gcount, getline, (C++ Strings) getline, ignore, peek, put, read