8
24
2010
1

unix 2-1

 

if(lseek(STDIN_FILENO,0,SEEK_CUR)==-1)
    printf("can't seek");
else printf("seek ok");

off_t lseek(int fileds,off_t offset,int whence)

whence: SEEK_SET SEEK_CUR SEEK_END
某些设备lseek返回值为负值,所以测试的时候应该小心,不要测试是否小于0,测试是否为-1

 

Category: unix | Tags: lseek File

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com