/*
lseek
测试能否对标准输入设置偏移量
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>//lseek需要
int main(int argc,char const argv[])
{
if(lseek(STDIN_FILENO,0,SEEK_CUR) == -1)
{
printf("cannot seek\n");
}
else
printf("seek OK\n");
exit(0);
}
/*
./a.out
cannot seek
./a.out < /etc/passwd
seek OK
*/
文件I/O-001.lseek验证有些文件是否能lseek
