The fuckup is somewhere in the top half, just included the whole thing in case you need it while(!inputFile.eof()) { // create an array of pointers of size SIZE. keyPointer = new char*[SIZE]; // read in until you reach the : symbol. Store in a temp array. inputFile.getline(temp, length, ':'); // set long1 equal to the length of the temp array. int long1 = strlen(temp); // create an array that is pointed to by a pointer in an array of pointer // this array is the size long1 and holds the first key keyPointer[count] = new char[long1 + 1]; // copy the value in temp into the newly created array strcpy(keyPointer[count], temp); long1 = 0; valuePointer = new char*[SIZE]; inputFile.getline(temp, length, '&'); long1 = strlen(temp); valuePointer[count] = new char[long1 + 1]; strcpy(valuePointer[count], temp); count++; // the problem is not below here if(count == SIZE && !inputFile.eof()) { count = 0; tempVal = new char*[SIZE]; tempKey = new char*[SIZE]; // copy original values over for(int count = 0; count < SIZE; count++) { int length1 = (strlen(keyPointer[count]) + 1); tempKey[count] = new char[length1]; strcpy(tempKey[count], keyPointer[count]); length1 = (strlen(valuePointer[count]) + 1); tempVal[count] = new char[length1]; strcpy(tempVal[count], valuePointer[count]); } // delete old arrays delete [] valuePointer; delete [] keyPointer; // add to size SIZE += 3; // recreate larger arrays of pointers keyPointer = new char*[SIZE]; valuePointer = new char*[SIZE]; for(int count = 0; count <= SIZE - 3; count ++) { int length1 = (strlen(tempKey[count]) + 1); keyPointer[count] = new char[length1]; strcpy(keyPointer[count], tempKey[count]); length1 = strlen((tempVal[count]) + 1); valuePointer[count] = new char[length1]; strcpy(valuePointer[count], tempVal[count]); } } }