Read a textfile to numbers

Just starting out? Need help? Post your questions and find answers here.
Goos E
New User
New User
Posts: 6
Joined: Sun Mar 15, 2009 2:55 pm
Location: Netherlands

Read a textfile to numbers

Post by Goos E »

I would like to read a list like i show you in numbers. I tried with readlong readinteger readfloat but i get no right numbers. I also tried readbyte and convert it myself.
The list is in a File at my computer

2 0 14 0
129987.20 515604.60
129941.10 515435.40
129927.30 515199.20
129931.40 515155.20
129936.40 514997.60
129921.00 514991.80
129920.20 514985.10
129936.40 514983.50
129946.30 514711.60
129952.10 514681.60
129943.00 514637.50
129995.70 514410.60
0 0
2 0 14 0
126344.80 488153.80
126388.20 488185.50
0 0
2 0 14 0
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

> I tried with readlong readinteger readfloat but i get no right numbers.
sure, because those are for binary saved numbers.
what you hafe there is a text, thus your variable type is a string.

read all with ReadString,
cut it in pieces using StringField with [SPACE] as separator,
and use StrF or StrD to convert the parts into numeric variables.
oh... and have a nice day.
Goos E
New User
New User
Posts: 6
Joined: Sun Mar 15, 2009 2:55 pm
Location: Netherlands

Post by Goos E »

Thank you very much that helped.

Goos.
Post Reply