jduffell
April 5th, 1999, 11:42 AM
I need to construct/manipulate a string that contains multiple null bytes within the string. From what I've read I need to use basic_string in order to do this. I think I'm just not constructing it properly. Does anyone have any examples on how to create/manipulate a string that can handle char(0) anywhere within the string?
Alvaro
April 5th, 1999, 11:59 AM
What about using a good old-fashioned array of characters? It's primitive but it lets you do whatever you want.
Other than that, I don't know what you can use. Good luck!
Alvaro
Dave Lorde
April 6th, 1999, 08:21 AM
Both MFC's CString and STL's basic_string may contain embedded null characters, but unfortunately, the string manipulation facilities in both MFC and STL generally expect zero-terminated strings, so will not behave as you expect. (Extract from docs: "The sequences controlled by an object of template class basic_string are usually called strings. These objects should not be confused, however, with the null-terminated C strings used throughout the Standard C++ library.").
I guess you'll need to write your own manipulation routines.
Dave