CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: stl

  1. #1
    Join Date
    Apr 1999
    Posts
    13

    stl

    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?


  2. #2
    Join Date
    Apr 1999
    Location
    Miami, FL
    Posts
    67

    Re: stl

    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

  3. #3
    Join Date
    Apr 1999
    Posts
    383

    Re: stl

    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




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured