System.SysUtils.StrLCopy

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function StrLCopy(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): PAnsiChar;
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: Ansi version of StrLCopy is deprecated. Please use 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 (Object Pascal) 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