Pārlūkot izejas kodu

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 pirms 9 gadiem
vecāks
revīzija
2ef5fa98e1
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 3
    1
      configuration.cpp

+ 3
- 1
configuration.cpp Parādīt failu

@@ -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.

Notiek ielāde…
Atcelt
Saglabāt