reading data from a file



Am 16 Nov 2006 um 12:39 hat Fabrizio Caruso geschrieben:


> but I can't find a way to read from a file.
> 
>   Fabrizio

Hi Fabrizio,

in the package stringproc you find functions for input and output ...

(%i1) load("stringproc")$
(%i2) s: openr("D:/test.txt");
(%o2) 			  #<input stream D:/test.txt>
(%i3) while stringp( tmp:readline(s) ) do print(tmp)$
Hello, 
world! 
(%i4) close(s)$

... and for parsing and manipulating strings. One exception: These functions cannot work 
with bigfloats. In case of bigfloats you should consider function parse_string, which can be 
loaded by load("eval_string").

HTH
Volker