lseek产生空洞文件
时间:2010-08-26 来源:snailshen
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main (int argc,char* argv[]){
int fd;
if((fd = creat("file.hole",O_CREAT))<0)
perror("creat error!!");
if(write(fd,"abcdefghij",10)!=10)
perror("wirte error!!");
if(lseek(fd,40,SEEK_SET)==-1)
perror("lseek error!!!");
if(write(fd,"ABCEDFGHIJ",10)!=10)
perror("wirte2 error!!");
return 0;
}
相关阅读 更多 +
排行榜 更多 +








![《房产达人2》 v1.11.1.0升级档+未加密补丁[RUNE]](https://images.phpfans.net/img/f1/20251224/logo_694bdc496c5a91.jpg)
![《终结者: 黑暗命运 - 反抗》 v1.08.1158升级档+未加密补丁[RUNE]](https://images.phpfans.net/img/f1/20251224/logo_694bdc464b6c41.jpg)
