IT

lseek1.c

kio467 2014. 9. 17. 17:48

#include <unistd.h>

#include <fcntl.h>

#include <sys/types.h>


int main()

{

int file, n_chars;


        if((file=open("a.txt",O_RDWR)) == -1)

                return 1;

 

        if(lseek(file,7,SEEK_SET) < 0) return 1;

 

if(write(file,"r", 1))

return 1;

close(file);

 

        return 0;

}