Rick wrote: > I want to create a string in C++ by starting with a base then adding > more. In C i would do something like: > > char str[128]; > > strcpy(str, "first part of string"); > strcat(str, "--second part of string"); > > How would I do this in C++? > > ~Rick
#include <string> ... std::string str; str = "first part of string"; str += "--second part of string"; ... Or something like that. I use BString from Safe C++ Design Principles (free e-book for c-prog members in Files section) which is much more versatile than std::string. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
