简体   繁体   English

错误无效的操作数到C中的二进制表达式

[英]Error invalid operands to binary expression in C

I am trying to move one position back in the stdin.Using this code: 我正在尝试在标准输入中向后移动一个位置,使用以下代码:

fpos_t fPos;
fgetpos(stdin,&fPos);
fPos -= 1;
fsetpos(stdin,&fPos);

But I get this error: 但是我得到这个错误:

 invalid operands to binary expression ('fpos_t'(aka '_G_fpos_t') and 'int')

But my question is why I get it? 但是我的问题是为什么我要得到它? Then how can I set the fPos to one position behind? 那么如何将fPos设置在后面的某个位置?

Thanks. 谢谢。

fpos_t is a structure, not an int, and it's only meant to be used in fgetpos and fsetpos calls - you're not supposed to manipulate it directly fpos_t是一个结构,而不是一个int,它仅用于fgetpos和fsetpos调用中-您不应该直接对其进行操作

Use fseek() with SEEK_CUR argument to manipulate the current stream position 将fseek()与SEEK_CUR参数一起使用以操纵当前流的位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM