Null-Terminated Strings

The "Null-terminated strings"(NTS) term was initially defined in C language where NTS is a byte array which has "0" character at the end. This character means the end of the string and may use as the condition to exit from loop while operating with strings (strcpy/strcat/strlen and so on). After adopting UNICODE standard NTS term was a bit changed. Now it is a character array (usually 2 byte array) that has same "0" character at the end.

Such strings are widely used in ActiveX component programming, where to operate with string BSTR type is used. MSDN defines BSTR type as the following:

A BSTR, known as basic string or binary string, is a pointer to a wide character string used by Automation data manipulation functions.
typedef OLECHAR FAR* BSTR;
BSTRs are wide, double-byte (Unicode) strings on 32-bit Windows platforms and narrow, single-byte strings on the Apple PowerMac.

Integrated Development Environment (IDE) usually creates a wrapper that substitutes BSTR parameters on those characteristic for the current IDE while adding ActiveX component on the form. Using this wrapper further component integration takes place.

Below is a list of types, BSTR is substituted to:

  • WideString (in Delphi)
  • String (in Visual Basic)
  • BSTR (in VC6/VC7/BCB6) however CString (VC 6/7) and WideString (BCB6) significantly simplify string operations