Oracle Solaris Studio 12.2:C++ 用户指南

13.3.7 查看输入

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


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