Hi,
In this approach,
http://www.daniweb.com/software-development/cpp/threads/268868/reading-and-writing-binary-file-c
I don't see if it is putting any real file structure to the binary file by the following?
In this approach,
http://www.daniweb.com/software-development/cpp/threads/268868/reading-and-writing-binary-file-c
I don't see if it is putting any real file structure to the binary file by the following?
#include "CarClass.h" #include <fstream> #include <sys/stat.h> using namespace std; ifstream::pos_type size; char * memblock; int main () { ifstream file ("read.bin", ios::in|ios::binary|ios::ate); if (file.is_open()) { size = file.tellg(); memblock = new char [size]; file.seekg (0, ios::beg); file.read (memblock, size); file.close(); cout << "the complete file content is in memory"; delete[] memblock; } else cout << "Unable to open file"; return 0; }
Many Thanks & Best Regards, Hua Min