System.AnsiStrings.StrLCopy

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function StrLCopy(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): PAnsiChar;

C++

extern DELPHI_PACKAGE char * __fastcall StrLCopy(char * Dest, const char * Source, unsigned MaxLen)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.AnsiStrings.pas
System.AnsiStrings.hpp
System.AnsiStrings System.AnsiStrings

Description

Copies up to a specified maximum number of characters from a source to a destination.

StrLCopy copies a maximum of MaxLen characters from Source to Dest, adds a null terminator to Dest and returns Dest. Keep in mind that you need to provide a large enough Dest to accommodate the null terminator. For example, you can specify MaxLen as Length(Dest) - 1.

Do not use SizeOf instead of Length, as that may lead to buffer overflow problems with Unicode Strings. See String Types (Delphi) for more information about Strings and about the behavior of SizeOf and Length when used with different types of Strings.

See Also

Topics

Code Examples