Yorick Reference Card

Web Home
Getting Started
Manual
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 ## Opening and Closing Text Files
`f = open(filename, mode)` | open filename in mode
`close, f` | close file f (automatic if f redefined)
The mode is a string which announces the type of operations you intend to perform: `"r"` (the default if mode is omitted) means read operations only, `"w"` means write only, and destroy any existing file filename, `"r+"` means read/write, leaving any existing file filename intact. Other mode values are also meaningful; see `help`. The file variable f is a distinct data type in Yorick; text files have a different data type than binary files. The `print` or `info` function will describe the file. The `close` function is called implicitly when the last reference to a file disappears.