System.SysUtils.TMarshaller.AllocStringAsAnsi
Delphi
function AllocStringAsAnsi(const Str: string): TPtrWrapper; overload;
function AllocStringAsAnsi(const Str: string; CodePage: Word): TPtrWrapper; overload;
C++
System::TPtrWrapper __fastcall AllocStringAsAnsi(const System::UnicodeString Str)/* overload */;
System::TPtrWrapper __fastcall AllocStringAsAnsi(const System::UnicodeString Str, System::Word CodePage)/* overload */;
Properties
| Type | Visibility | Source | Unit | Parent | 
|---|---|---|---|---|
| function | public | System.SysUtils.pas System.SysUtils.hpp | System.SysUtils | TMarshaller | 
Description
Copies a string into a buffer.
The AllocStringAsAnsi method is overloaded:
- The first overloaded function returns a wrapped pointer referencing a buffer containing a copy of Strencoded in the default multi-byte encoding, with a null terminator. The buffer will be freed when Flush is called or the record goes out of scope.
- The second overloaded function returns a wrapped pointer referencing a buffer containing a copy of Strencoded in the multi-byte encoding specified byCodePage, with a null terminator. The buffer will be freed when Flush is called or the record goes out of scope.