#include #include #include #include #include int main (int argc, char **argv) { int rf = open ("random.txt",O_RDWR | O_CREAT | O_APPEND ,0644); /* write (rf,"You suck\n",9); lseek (rf,4,SEEK_SET); //4 bytes from the beginning of the file write (rf,"d",1);*/ /* write (rf,"Ima",3); //Since I didn't erase anything, it just overwrote from the begining*/ /* for (char c = 'A'; c <= 'Z'; c++) { lseek (rf,0,SEEK_SET); write (rf,&c,1); } lseek (rf,4,SEEK_SET); char buf[5]; buf[4] = '\0'; read (rf,buf,4); printf ("%s\n",buf);*/ ftruncate (rf,9000); close (rf); return 0; }