Sun Studio 12 Update 1:C++ 用户指南

14.3.7 查看输入

可以使用 peek 成员函数查看流中的下一个字符,而不必提取该字符。例如:


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