我有一个文件,其值如:START和STOP。我还声明了以下枚举:
enum Type {
START,
STOP
};
Run Code Online (Sandbox Code Playgroud)
我正在尝试将枚举设置为等于文件中的第一个值,如下所示:
enum Type foo;
ifstream ifile;
ifile.open("input.txt");
ifile >> foo;
Run Code Online (Sandbox Code Playgroud)
我收到错误消息:'ifile >> foo'中的'operator >>'不匹配。
如何正确执行此操作?
| 归档时间: |
|
| 查看次数: |
7364 次 |
| 最近记录: |