Sun Studio 12 Update 1: C++ User's Guide

14.3.7 Peeking at Input

You can use the peek member function to look at the next character in the stream without extracting it. For example:


if (cin.peek()!= c) return 0;