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

cin

Library:  Input/output

Local Index

No Entries

Summary

A predefined stream that controls input from a stream buffer associated with the object stdin declared in <cstdio>

Synopsis

#include <iostream>

namespace std {
  extern istream cin;
}

Description

The object cin controls input from a stream buffer associated with the object stdin declared in <cstdio>. By default, the standard C and C++ streams are synchronized, but you can improve performance by using the ios_base member function synch_with_stdio to desynchronize them.

After the object cin is initialized, cin.tie() returns &cout, which implies that cin and cout are synchronized.

Warnings

Keep in mind that while the manipulator endl flushes the stream buffer, outputting the character '\n' is not guaranteed to flush the stream buffer. You should output the '\n' character without endl only if you do not need the buffer flushed. Note that outputting the '\n' character in such cases, and hence not forcing a buffer flush, may result in a performance improvement. It greatly improves performance when C and C++ streams are not synchronized.

See Also

basic_istream, basic_iostream, basic_filebuf, cout, cerr, clog, wcin, wcout, wcerr, wclog, ios_base, basic_ios

Standards Conformance

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



Previous fileTop of DocumentContentsIndex pageNext file