EmbLogic's Blog

program to make a 4gb file with free space. file with holes.

#include<stdio.h>
#include<fcntl.h>
int openf(char *);
int main(int argc, char * argv[])
{
int fd,fd1, pos,i=1000000;
char ch=”;
fd = openf(argv[1]);
pos = lseek(fd,i * 4096, SEEK_SET);
write(fd, &ch,1);
close(fd);
}
int openf(char * s)
{
int fd;
fd = open(s,O_RDWR|O_CREAT,0666);
if(fd < 1)
perror(“open error”);
else
printf(“input file open succesfull fd = %d\n”,fd);
return fd;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>