#include <stdio.h>
/***************************
*name:fseek.c
*author:QG
*time :2015-05-12
*description:
****************************/
int main()
{
FILE *fp_in;
char *in_file_name = "./123.txt";
char c_buf[10];
int a = 0;
fp_in = fopen(in_file_name,"r+");
a = fseek(fp_in,2,SEEK_SET);
if(a == 0)
{
printf("location OK!\n");
}
else if(a == -1)
{
printf("location fail!\n");
}
fread(c_buf,1,9,fp_in);
c_buf[9] = '\0';
printf("read content is : %s!\n",c_buf);
close(fp_in);
return 0;
}
库函数调用 5--fseek
最新推荐文章于 2024-10-10 21:25:58 发布