seek
seek — sets the file position for reading or writing.
seek (file, offset, where)
fileA file pointer to a previously opened file. This may be either a file in the file system, or a string opened for read and write.
offsetAn integer specifying the number of characters into the file,
starting from where.
whereA starting point, indicated by a number:
0 Beginning of the file.
1 Current position in the file.
2 End of the file.
This function lets you specify a position in a file to start reading or writing.
The file "myseekfile" contains the following:
Now is the time for all good men and women to come to the aid of their world.
Gamma>msk = open("myseekfile.dat", "r",nil);#<File:"myseekfile.dat">Gamma>seek(msk, 5, 0);tGamma>read_line(msk);"s the time for all good men and women"Gamma>seek(msk, 2, 1);tGamma>read_line(msk);" come to the aid of their world."Gamma>seek(msk, -15, 2);tGamma>read_line(msk);"of their world."Gamma>seek(msk, -3, 0);nilGamma>
open, open_string, read, read_char, read_double, read_float, read_line, read_long, read_short, read_until, tell