Bläddra i källkod

Increased size of myDataBuffer by one in a different location.


git-svn-id: https://svn.microneil.com/svn/CodeDweller/branches/adeniz_1@71 d34b734f-a00e-4b39-a726-e4eeb87269ab
adeniz_1
adeniz 9 år sedan
förälder
incheckning
2ef5fa98e1
1 ändrade filer med 3 tillägg och 1 borttagningar
  1. 3
    1
      configuration.cpp

+ 3
- 1
configuration.cpp Visa fil

@@ -1211,9 +1211,11 @@ ConfigurationData::ConfigurationData(const string FileName) :
ifstream CFGFile(FileName.c_str()); // Open the file.
CFGFile.seekg(0,ios::end); // Seek to the end
myBufferSize = CFGFile.tellg(); // to find out what size it is.
myDataBuffer = new char[myBufferSize]; // Make a new buffer the right size.
myDataBuffer = new char[myBufferSize + 1]; // Make a new buffer the right size,
// including null byte at end.
CFGFile.seekg(0,ios::beg); // Seek to the beginning and
CFGFile.read(myDataBuffer, myBufferSize); // read the file into the buffer.
myDataBuffer[myBufferSize] = '\0'; // Null-terminate.
if(CFGFile.bad()) { // If the read failed, we're unusable!
delete[] myDataBuffer; // Delete the buffer
myDataBuffer = NULL; // and Null it's pointer.

Laddar…
Avbryt
Spara