使用常量文件指针倒带和 fscanf

using constant filepointer to rewind and fscanf

我正在尝试使用 const FILE *fp 倒带、fscanf 等常用的东西,但我 运行 进入 c4090 错误,我不太理解它。

int search(const FILE *fp, int patt) {
   if (fp != NULL) {
     rewind(fp) //Getting c4090 warning
     //other statements
   }
}

这似乎是一个基本问题,我尝试搜索了一下,微软手册是我所拥有的大部分内容,但我并不真正理解它们的含义

"This warning can be caused when a pointer to a const or volatile item is assigned to a pointer not declared as pointing to const or volatile."

来源:https://msdn.microsoft.com/en-us/library/k77bkb8d.aspx

尝试:

int search(FILE *fp, int patt) {
    if (fp != NULL) {
     rewind(fp) //No c4090 warning, Because we can change fp
     //other statements
    }
}