Dear Forum,
Lisette Brillemans wrote:
> I would like to read some integers from a text file into my program.
> So the file looks something like this:
>
> 34,56,12,8,75,4,23
>
> and I would like a program to read these integers into a file.
>
> I would like to know how to do this and many thanks in advance for any
> help.
This can be done as follows :
gap> numbers :=
List(SplitString(StringFile("C:/GAP/NUMBERS.TXT"),",","\r\n"),Int);
[ 34, 56, 12, 8, 75, 4, 23 ]
Of course "C:/GAP/NUMBERS.TXT" needs to be replaced by the path and name of
your file.
Hope this helps,
Stefan Kohl
_______________________________________________
Forum mailing list
[email protected]
http://mail.gap-system.org/mailman/listinfo/forum