Web Home
Getting Started
Manual
Packages
Quick Reference
Language Reference
Function Reference
I/O Reference

- Language Reference
- Function Reference
- I/O Reference
  - Opening and Closing Text Files
  - Reading Text
  - Writing Text
  - Positioning a Text File
  - Opening and Closing Binary Files
  - Saving and Restoring Variables
  - Reading History Records
  - Writing History Records
  - Opening Non-PDB Files
  - Making Plots
  - Plot Paging and Hardcopy
  - Setting Plot Limits
  - Managing Graphics Windows
  - Graphics Query, Edit, and Defaults

# Yorick I/O 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.