Google

Yorick Reference Card

yorick banner

Home

Manual

Packages

Global Index

Keywords

Quick Reference

Yorick Language Reference

Positioning a Text File

The write function always appends to the end of a file.

A sequence of read operations may be intermixed with write operations on the same file. The two types of operations do not interact.

The read and rdline functions read the file in complete lines; a file cannot be positioned in the middle of a line - although the read function may ignore a part of the last line read, subsequent read operations will begin with the next full line. The following functions allow the file to be reset to a previously read line.
backup, f back up file f one line
m = bookmark(f) record position of file f in m
backup, f, m back up file f to m

The bookmark m records the current position of the file; it has a distinct Yorick data type, and the info or print function can be used to examine it. Without a bookmark, the backup function can back up only a single line.