diff options
1 files changed, 9 insertions, 0 deletions
| -rw-r--r-- | src/Generic/String/String.cpp | 9 |
diff --git a/src/Generic/String/String.cpp b/src/Generic/String/String.cpp index 4de5a29..bacd72c 100644 --- a/src/Generic/String/String.cpp +++ b/src/Generic/String/String.cpp @@ -36,6 +36,15 @@ unsigned String::get_length() const { } String& String::operator+=(const char* str) { + unsigned strLen = strlen(str); + char* newStr = new char[length + strLen + 1]; + strncpy(newStr, this->str, length + 1); + strncat(newStr, str, strLen + 1); + + delete[] this->str; + this->str = newStr; + length += strLen; + return *this; } |
