   reading float from binary file
  Hey,Is there any "good" way to save and load floats from binary file? I was thinking on how to do this and came up with this:#include <iostream>#include <fstream>using namespace std;int main(){    /*----output-------*/    ofstream out;    out.open("test.bin",ios::binary);    if( out.is_open() )   cout << "Opened file for output\n";    else return 0;    float value = 1.12;    out.write( (const char*) &value, sizeof(float) );    out.close();    /*--input---------*/    ifstream in;    in.open("test.bin",ios::binary);    if( in.is_open() )   cout << "Opened file for input\n";    else return 0;    float temp;    in.read( (char*) &temp, sizeof(float) );    cout << "File content: " << temp << "\n";    in.close();} It works but i'm not sure is it the right way it to do it. It also looks i could use it for other types, and change the way i'm doing it with ints(reading char array and converting it to int using some bitwise operators).   
  That's generally how floats and such are written to a binary file. Just keep in mind that reading it back on different architectures may not work.   