Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>istream::get</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
istream::get
istream::peek

Usage

   #include <iostream.hpp>
   int istream::get();
   int istream::peek();

Description

   These unformatted input functions return the value of the next character
   in the input stream, or end of file if no further character is available.
   The prefix function is called (ipfx(1)), but the error state is not
   effected. Get removes the character from the input stream, while peek

   leaves it there.

Example 

   // Input stream "abcdefg"
   int c = cin.peek()

   if (c != EOF)
       cout << char(c);    // output is 'a'

   c = cin.get();

   if (c != EOF)
       cout << char(c);    // output is 'a'

   c = cin.get();

   if (c != EOF)
       cout << char(c);    // output is 'b'

Return Value

   An int representing the character peeked or got, or EOF if no character
   was available.





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson