yorick banner

Home

Manual

Packages

Global Index

Keywords

Quick Reference

Yorick Language Reference

Opening and Closing Binary Files

f = openb(filename) open filename read-only
f = updateb(filename) open filename read-write
f = createb(filename) create the binary file filename
close, f close file f
A binary file f has a Yorick data type which is distinct from a text file. The info and print functions describe f. The close function will be called implicitly when the last reference to a file disappears, e.g.- if f is redefined.

The data in a binary file is organized into named variables, each of which has a data type and dimensions. The . operator, which extracts members from a structure instance, accepts binary files for its left operand. Thus:
 f = updateb("foo.bar");
 print, f.var1, f.var2(2:8,::4);
 f.var3(2,5) = 3.14;
 close, f;

Opens a file, prints var1 and a subarray of var2, sets one element of var3, then closes the file.

The show command prints an alphabetical list of the variables contained in a file:

show, f       shows the variables in file f
show, f, pat  show only names starting with pat
get_vars(f)   returns pointers to complete name lists for f