Here, I knocked this up as a quick example:
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main(void)
{
double d1 = 10.5, d2 = 0;
fstream myfile("out.dat", ios::out | ios::binary);
if (!myfile)
{
perror("out.dat");
return(0);
}
myfile.write((char *) &d1, sizeof(d1));
myfile.close();
myfile.open("out.dat", ios::in | ios::binary);
if (!myfile)
{
perror("out.dat");
return(0);
}
myfile.read((char *) &d2, sizeof(d1));
myfile.close();
cout << d2 << endl;
return(0);
}
In your code, what's the 4 byte buffer all about?
>>keep in mind, binary isnt like textpad kinda stuff so what it returns may be differant than what ya put in
What are you talking about?!