본문 바로가기

IT

lseek1.c

#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;

}

'IT' 카테고리의 다른 글

ls3.c  (0) 2014.09.24
JsonTest.java  (0) 2014.09.19
cp1.c  (0) 2014.09.17
who1.c  (0) 2014.09.17
java network programming 2  (0) 2014.08.30