Created
November 3, 2016 17:17
-
-
Save skymansandy/98ad1b4307774b0be2474f96f94db8d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#include<fcntl.h> | |
#include<sys/stat.h> | |
#include<sys/types.h> | |
#include<unistd.h> | |
int main() | |
{ | |
char buff1[ ]="abcdefghijklmnop "; | |
char buff2[ ]="ABCDEFGHIJKLMNOP "; | |
int fd; | |
fd=open("new.dat",O_WRONLY|O_CREAT,0777); | |
write(fd,&buff1,16); | |
lseek(fd,48,SEEK_SET); | |
write(fd,&buff2,16); | |
close(fd); | |
printf("The contents of the file are:\n"); | |
system("od -c new.dat"); | |
exit(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment