openRead

HC Communication File opening openRead
File opening openReadBin

openRead filename


command. Opens the named file for reading. The read position is initially at the beginning of the file.

Example:

openRead "tree.lg
setReader "tree.lg
while [not eof?] [pr readWord]

Whose output is:

to tree [level 7][size 100]
	if level==0 [stop]
	fd size
	lt 80
	tree2 level-1 size/2
	rt 70
	(tree level-1 size*2/3)
	rt 90
	tree2 level-1 size/2
	lt 80
	bk size
end size

to tree2 level size
	if level==0 [stop]
	fd size
	rt 80
	(tree level-1 size/2)
	lt 70
	tree2 level-1 size*2/3
	lt 90
	(tree level-1 size/2)
	rt 40
	(tree level-1 size*4/5)
	rt 40
	bk size
end size

Then you can ask:

ReaderPos		;387  ;-)

See also:

Examples:

References:

File opening openReadBin