#include <iostream>
#include <fstream>
using namespace std;
int main(){
fstream file("datafile.bin",ios::in|ios::binary);
int i;
while(file.good()){
file.read((char*)&i, sizeof(i));
if(file.good())
cout<<i<<", ";
}
file.close();// no need
return 0;
}
Why the output is end of 9999,begin with 6012?
No comments:
Post a Comment