DataType
CString
Description
A null-terminated, C-style String for use when working with OS APIs.
Notes
A CString is a low-level C-style string for use with Declares and MemoryBlocks. CStrings created from Text or Xojo.Core.MemoryBlock and CStrings stored in Autos are reference-counted and safe to keep around. Otherwise, if the string/object that the CString originates from is tied to the lifetime of that string/object.
String
You can assign a String variable to a CString and it will be terminated with a null automatically. This only converts the String up to the first Null (0) byte value. CString implicitly converts to String when assigned to String variables.
Text
To convert a Text value to a CString, call Text.ToCString. This will only convert the Text up to the first Null (0) byte value. To convert a CString to a Text value, call Text.FromCString.
Sample code
Declare a CString variable:
Var s As String = "Hello!"
Var cs As CString = s
Compatibility
All project types on all supported operating systems.
See also
String data type