System.SysUtils.StrLCopy

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function StrLCopy(Dest: MarshaledAString; const Source: MarshaledAString; MaxLen: Cardinal): MarshaledAString; overload;
function StrLCopy(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar;

C++

extern DELPHI_PACKAGE char * __fastcall StrLCopy _DEPRECATED_ATTRIBUTE1("Moved to the AnsiStrings unit") (char * Dest, const char * Source, unsigned MaxLen)/* overload */;

Properties

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

Description

Warning: The ANSI version of StrLCopy is deprecated. Please use the AnsiStrings unit.

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