Google

Yorick Reference Card

yorick banner

Home

Manual

Packages

Global Index

Keywords

Quick Reference

Yorick Language 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.