lstrcat function

Appends one string to another.

Warning  Do not use. Consider using StringCchCat instead. See Security Considerations.

Syntax


LPTSTR WINAPI lstrcat(
  _Inout_  LPTSTR lpString1,
  _In_     LPTSTR lpString2
);

Parameters

lpString1 [in, out]

Type: LPTSTR

The first null-terminated string. This buffer must be large enough to contain both strings.

lpString2 [in]

Type: LPTSTR

The null-terminated string to be appended to the string specified in the lpString1 parameter.

Return value

Type: LPTSTR

If the function succeeds, the return value is a pointer to the buffer.

If the function fails, the return value is NULL and lpString1 may not be null-terminated.

Security Considerations

Using this function incorrectly can compromise the security of your application. This function uses structured exception handling (SEH) to catch access violations and other errors. When this function catches SEH errors, it returns NULL without null-terminating the string and without notifying the caller of the error. The caller is not safe to assume that insufficient space is the error condition.

lpString1 must be large enough to add lpString2 and the closing '\0', otherwise a buffer overrun may occur. Buffer overruns may lead to a denial of service attack against the application if an access violation occurs. In the worst case, a buffer overrun may allow an attacker to inject executable code into your process, especially if lpString1 is a stack-based buffer.

Consider using StringCchCat instead.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winbase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

Unicode and ANSI names

lstrcatW (Unicode) and lstrcatA (ANSI)

See also

Reference
StringCbCat
StringCbCatEx
StringCbCatN
StringCbCatNEx
StringCchCat
StringCchCatEx
StringCchCatN
StringCchCatNEx
lstrcmp
lstrcmpi
lstrlen
Conceptual
Strings

 

 

Community Additions

ADD
Show:
© 2014 Microsoft