: UNIX

5.5 , - LSEE

5.5 , - LSEE

read write , lseek , -, . :

position = lseek(fd, offset, reference);

fd , , offset , reference , offset , - . , position, , . , , 5.10, , , lseek, , 1023 ( reference, 1), . , 1024- . reference 0, , 2, . lseek , , - . , lseek, ; read write .

#include fcntl.h
main(argc, argv)
int argc; char *argv[];
{
int fd, skval;
char c;
if (argc != 2) exit();
fd = open(argv[1], O_RDONLY);
if (fd == -1) exit();
while ((skval = read(fd, &c,1 ))== 1){
printf("char %cn", c);
skval = lseek(fd, 1023L, 1);
printf("new seek val %dn", skval);
}
}

5.10. , lseek


: 0.071. /Cache: 5 / 0