diff options
Diffstat (limited to 'include/utils/string_array.h')
-rw-r--r-- | include/utils/string_array.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/utils/string_array.h b/include/utils/string_array.h index ede0644..064dda2 100644 --- a/include/utils/string_array.h +++ b/include/utils/string_array.h @@ -111,6 +111,19 @@ public: return mArray[idx]; } + // + // Set entry N to specified string. + // [should use operator[] here] + // + void setEntry(int idx, const char* str) { + if (idx < 0 || idx >= mCurrent) + return; + delete[] mArray[idx]; + int len = strlen(str); + mArray[idx] = new char[len+1]; + memcpy(mArray[idx], str, len+1); + } + private: int mMax; int mCurrent; |