"String" (编译类型)
"String"
表示一个字符串类型说明符.
更多信息
- "String" 可使用于 Typed 和相关架构来指定一种类型.
- "String" objects are automatically memory managed.
属性
- 储存在 "String" 类型值中的字符与 String 表达式中的一样.
构建器
- CreateTypeInstance["String",cstr,len] 根据长度为 len 的 C 字符串 cstr 创建字符串. cstr 的类型可以是 "CString" 或 "Managed"::["CString"].
- CreateTypeInstance["String",cstr] 根据以 null 结尾的 C 字符串 cstr 创建字符串.
范例
打开所有单元关闭所有单元基本范例 (1)
"String" 可用作 CompiledCodeFunction 的输入和输出:
范围 (1)
Cast a string to a "Managed"::["CString"] and print its contents:
When a managed object is passed to a function from a library, the raw object is automatically unpacked.
When a managed object is no longer used, it frees its contents.
可能存在的问题 (1)
A string can be cast to a "CString", but the result will need to be freed with a call to DeleteObject when it is no longer used: