Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void aieString::Append(const char* strToAppend)
- {
- // temporary array for copying
- char tmpArray[256] = {};
- // copy data values to new array
- for (int i = 0; i < length; i++)
- {
- tmpArray[i] = data[i];
- }
- // copy strToAppend to the end of the temporary
- // array, up until the null terminator, when the
- // null terminator appears, wipe the data *char.
- // Make data's values correspond to the temporary
- // arrays values. Add the null terminator at the end,
- // and finally, break out of the loop, and function.
- for (int i = 0; i < 128; i++)
- {
- if (strToAppend[i] != '\0')
- {
- tmpArray[length] = strToAppend[i];
- length++;
- }
- else
- {
- data = new char[length];
- for (int j = 0; j < length; j++)
- {
- data[j] = tmpArray[j];
- }
- data[length] = '\0';
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement