reading a float from file
I'm having a problem reading float data type from file. The file is structured so that sets of float values would be separated by -99. (ie. 5.43, 6.78, 4.35, -99, 4.32, etc...). The -99 would flag the beginning of the next set. When I initially wrote the program, integers were saved to the file, and reading them back in were no problem. But then I modified the code to read and write floats, and it doesn't read them anymore. I've tried a couple of different ways:
Code:
data >> temp; //data is file, temp is var
data.getline (temp, sizeof(temp))
but both methods skip all the floats and only read in the -99. temp is declared as float. Why is this happening? How can I read in the float values? I've checked around, but can't find a specific answer to this. Any help would be greatly appreciated.