System.TMarshal.AllocStringAsAnsi

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class function AllocStringAsAnsi(const Str: string): TPtrWrapper; overload;
class function AllocStringAsAnsi(const Str: string; CodePage: Word): TPtrWrapper; overload;
class function AllocStringAsAnsi(S: PWideChar): TPtrWrapper; overload;
class function AllocStringAsAnsi(S: PWideChar; CodePage: Word): TPtrWrapper; overload;

Properties

Type Visibility Source Unit Parent
function public System.pas System TMarshal

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 Str encoded 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 Str encoded in the multi-byte encoding specified by CodePage, with a null terminator. The buffer will be freed when Flush is called or the record goes out of scope.
  • The third overloaded function returns a wrapped pointer referencing a buffer containing a copy of S encoded 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 fourth overloaded function returns a wrapped pointer referencing a buffer containing a copy of S encoded in the multi-byte encoding specified by CodePage, with a null terminator. The buffer will be freed when Flush is called or the record goes out of scope.

See Also