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 | Read Count: 1761
Avatar_small
creditos rapidos gra 说:
2019年3月26日 08:11

This is a very interesting post and I have learned so much by going through it.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

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