00001 #include <stdio.h> 00002 #include <stdlib.h> 00003 #include <unistd.h> 00004 #include <signal.h> 00005 #include <fcntl.h> 00006 #include <sys/types.h> 00007 #include <sys/stat.h> 00008 #include <fcntl.h> 00009 00010 char buffer[8192]; 00011 00012 int main(int argc, char **argv) 00013 { 00014 int i, j; 00015 int count; 00016 int fd; 00017 00018 if (argc == 0) { 00019 fprintf(stderr, "Usage lseek <filename>\n"); 00020 return 1; 00021 } 00022 00023 00024 for (i=0;i< 8192; i++){ 00025 buffer[i] = 'X'; 00026 } 00027 00028 fd = open(argv[1] ,O_RDWR| O_CREAT); 00029 00030 if (fd < 0) { 00031 printf("Opening file %s failed.\n",argv[1] ); 00032 return 1; 00033 } 00034 00035 printf("Soubor otevren :)\n"); 00036 00037 lseek(fd,200,SEEK_CUR); 00038 count = write(fd,buffer,100); 00039 close(fd); 00040 return 0; 00041 }