Tech Off Post

Single Post Permalink

View Thread: Problems with Chr(0)
  • User profile image
    Sven Groot

    .Net strings (and StringBuilders), as well as COM string (BSTR), can contain zero characters without problems, as they keep their length separately.

    However, if you were to attempt to display this string anywhere using any of the usual methods (nearly all of which use zero-terminated C-style strings internally), the string would appear to be cut off because it doesn't display anything beyond that character. Unfortunately, that also goes for the Visual Studio debugger. The string is there (check String(Builder).Length and you'll see it's the length of the whole thing not just up to the zero character). So while you can't see it, it's still there. I would just try to send that to the device and see if it works.