%
%	Get a file and put it into an array specified by the user.
%	Also return number of elements read.
%

procedure GetFile( var A: array 1..* of string, var num: int)
	var stream: int
	var filename: string
	var i: int := 0

	put "Enter a file name containing the list:  "..
	get filename

%	The file name should exist, etc.  These checks are omitted, but
%	you shouldn't.

	put "OK.  Taking data from ", filename
	open :stream, filename, get
	assert stream > 0

	loop
		get: stream, skip
		exit when eof(stream) or i >= N
		i := i+1
		get :stream, A(i):*
	end loop

	close :stream
	num := i

end GetFile
