getline

get

#include <iostream.h>int get();istream &get(char &ch): istream &get(char *buf, int num, char delim = '\n'); istream &get(streambuf &buf, char delim = '\n');

The get( ) function is a member of istream.

In general, get( ) reads characters from an input stream. The parameterless form of get( ) reads a single character from the associated stream and returns that value.

The form of get( ) that takes a single character reference reads a character from the associated stream and puts that value in ch. It returns a reference to the stream. (Note that ch may also be of type unsigned char * or signed char *.)

The form of get( ) that takes three parameters reads characters into the array pointed to by buf until either num characters have been read or the character specified by delim has been encountered. The array pointed to by buf will be null terminated by get( ). If no delim parameter is specified, by default a newline character acts as a delimiter. If the delimiter character is encountered in the input stream, it is not extracted. Instead, it remains in the stream until the next input operation. This function returns a reference to the stream. (Note that buf may also be of type unsigned char * or signed char *.)

The form of get( ) that takes two parameters reads characters from the input stream into the streambuf (or derived) object. Characters are read until the specified delimiter is encountered. It returns a reference to the stream.

Related functions are put( ), read( ), and getline( ).




C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net