Listing 11 Corrections to the corrections to the string class that appeared in Listing 9 of "Stepping Up to C++: Rewriting and Reconsidering," CUJ, September, 1993.

//
// append a nul-terminated string to a str
//
void str::cat(const char *s)
   {
   size_t n = len + strlen(s) + 1;
   char *p = strcpy(new char[len], ptr);
   strcat(p, s);
   delete [] ptr;
   ptr = p;
   len = n - 1;  // the - 1 was missing
   }

//
// append a str to a str
//
void str::cat(const str &s)
   {
   size_t n = len + s.len + 1;
   char *p = strcpy(new char[len], ptr);
   strcat(p, s.ptr);
   delete [] ptr;
   ptr = p;
   len = n - 1;  // the - 1 was missing
   }

// End of File