How to make string variable of unknown/dynamic length, not terminated by 0?

If I don't know the size a string will be, and if that size may change later, and if that string may contain '0' characters, what methods are there to do this? (I would prefer a professional/reliable method if possible)
0 characters are fine. \0 characters represent the end of a string.

But the most professional way to do it is to use the std::string in the C++ strings library.

std::string my_string;
int size = my_string.size()
There is no other way than dynamically to allocate memory for a new character array. Either you will do it yourself or you can use standard container std::string that will do this instead of you transparency for the source code.
Topic archived. No new replies allowed.