/* get the sizeof the source file by seeking to the end of it :
lseek () returns the offset location of the file pointer after
the seek relative to the beginning of the file , so this is a
good way to get an opened file
×/
if((filesize=lseek(in_fd,0,SEEK_END))==-1)
die("Could not seek to end of file",argv[1]);
/* by seeking to filesize in the new file can be grown to that size,
* its size does not change until a write occurs
*/
lseek(out_fd,filesize-1,SEEK_SET);
/* so we write the NULL byte and file size is now set to filesize */
write(out_fd,&nullbyte,1);
/* time to setup the memory maps */
if((source_addr=mmap(NULL,filesize,PROT_READ,MAP_SHARED,in_fd,0))==(void *)-1)
die("Error mapping file ",argv[1]);