I have a binary file which contains two numbers

1.2345
157

both number are separated with a newline.

When I read it back in to retieve the data I cannot get my orignal data back, I get a strange number.
Please help.

infile.read(buffer,4);

while(!infile.eof())
{

y = (double *) &buffer[0];
infile.read(buffer,4);
z = *y;


}
unsigned int x = (unsigned int)floor(z);
cout << z <<"|"<< x << endl;

infile.close();