I need to read .dat file which is in form:

x y z d
4.860568047E+000 1.591771126E+001 4.034203053E+000 1.000000000E+000
-2.356933117E+000 2.466155815E+001 -3.108083963E+000 1.000000000E+000
-1.673650980E+000 1.986449051E+001 6.616530895E+000 1.000000000E+000
-5.323183060E+000 1.964732361E+001 -7.041398048E+000 1.000000000E+000

I need to read the first line and put these values into a equation, say:
results = x+y+z+d, then read the second line, and use new values to do more calculations.

Is there a way to do this? Help anyone?

Thanks in advance!

Yes you need to read each line as a string and then convert the values to long double maybe? (using the space as a delimiter)