int main()
{
int i1 = 1, i2 = 2;
ofstream file("C:\\test.dat");
file<<i1<<i2;
file.close();
ifstream file1("C:\\test.dat");
file1>>i1;
file1.close();
cout<<i1<<endl;
}
the result is 12 not 1. Ints are wrote in byte by byte, but seems to be read out two bytes a time into i1 ? can anyone help me out?
{
int i1 = 1, i2 = 2;
ofstream file("C:\\test.dat");
file<<i1<<i2;
file.close();
ifstream file1("C:\\test.dat");
file1>>i1;
file1.close();
cout<<i1<<endl;
}
the result is 12 not 1. Ints are wrote in byte by byte, but seems to be read out two bytes a time into i1 ? can anyone help me out?