c语言fseek

可以这么用吗?

fseek(stdin,-1,SEEK_CUR);

第1个回答  2013-05-21
函数名称
fseek

包含头文件
stdio.h

功能
重定位流( 数据流/ 文件)上的文件内部位置指针。

格式
intfseek(FILE *stream, long offset, intfromwhere);

参数
fseek position the file(文件)position(位置)pointer(
指针)for the file referenced by stream to the byte location calculated by offset.
stream:文件流
offset:偏移量
fromwhere:起始位置
SEEK_SET:文件开头
SEEK_CUR:当前位置
SEEK_END:文件结尾

返回值
成功,返回0,失败返回-1,并设置errno的值,可以用perror()函数输出错误。追问

FILE *stream
可以是stdin吗?

追答

可以,FILE后面跟的是可以随意定义的变量名。

相似回答