"my_ifstream >> my_char"在哪里记录?

rcb*_*nan 2 c++

我正在使用"cin >> my_char"在我正在尝试解析的输入记录中删除':'.这是一个最小的例子.

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>

using namespace std;

int main () {
    char c;
    int x, y;

    cin >> hex >> x >> hex >> c >> y;
    cout << "x = " << x << "\ny = " << y << "\n";
}
Run Code Online (Sandbox Code Playgroud)

示例用法:

rc@timecube:/tmp$ g++ test.cpp && echo "0000a:ffff" | ./a.out 
x = 10
y = 65535
Run Code Online (Sandbox Code Playgroud)

这段代码完全符合我的要求,但我不明白为什么.我希望看到类似的东西:

istream& operator>> (char& val);
Run Code Online (Sandbox Code Playgroud)

在这里的istream参考,但我没有.

那么这种行为是如何记录的呢?

Lig*_*ica 7

在免费功能下.

并非所有运营商都是会员!