Original Post
Hi!
I'm trying to find the size of a binary file.
I've Googled around, and I constantly seem to be coming up with answers that are very similar to the code I have now;
Is this correct? Somehow, I don't think it is, because my program is always giving me an allocation error when I'm trying to initialize the MemBlock array.
By the way, what does ATE stand for?
I'm trying to find the size of a binary file.
I've Googled around, and I constantly seem to be coming up with answers that are very similar to the code I have now;
ifstream CurrentFile(Filename, ios::out | ios::in| ios::binary);
CurrentFile.seekg(ios::ate);
ifstream::pos_type size = CurrentFile.tellg();
char *MemBlock = new char[size];
CurrentFile.seekg(0, ios::beg);
CurrentFile.read(MemBlock, size);Is this correct? Somehow, I don't think it is, because my program is always giving me an allocation error when I'm trying to initialize the MemBlock array.
By the way, what does ATE stand for?