Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. void string::Insert(char *s, int index) {
  2.     int slen = strlen(s);
  3.     int len = Length() + slen;
  4.     char *temp = new char[len];
  5.     strncpy(temp, string_, index);
  6.     temp = strcat(temp, s);
  7.     temp = strcat(temp, &string_[index]);
  8.     freeMem();
  9.     getMem(len);
  10.     string_ = strcpy(string_, temp);
  11.     delete [] temp;
  12.     string_[len] = '\0';
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement