From Xojo Documentation


Text.ToCString(encoding As Xojo.Core.TextEncoding) As CString

Supported for all project types and targets.

Creates a CString from a Text with a specific encoding. The CString is immutable and is its own entity with the lifetime not tied to the source text value. This is provided to make dealing with declares easier.


In general, CString is for use with Declare commands and MemoryBlocks.


Sample Code

Convert text to CString:

Dim t As Text = "Hello, World!"
Dim cs As CString = t.ToCString(Xojo.Core.TextEncoding.UTF8)