StrCat <shlwapi.h> strcat <string.h> wcscat <string.h>
2012-06-28 15:33
603 查看
StrCat Function
--------------------------------------------------------------------------------
Appends one string to another.
Syntax
LPTSTR StrCat( LPTSTR psz1,
LPCTSTR psz2
);
Parameters
psz1
[in, out] Pointer to a null-terminated string to which the function appends psz2. This buffer must be large enough to hold both strings
and the null terminator.
psz2
[in] Pointer to a null-terminated string to be appended to psz1.
Return Value
Returns a pointer to psz1, which holds the combined strings.
Remarks
Security Alert Using this function incorrectly can compromise the security of your application. The first argument, psz1, must be large
enough to hold psz2 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 psz1 is a stack-based buffer. Consider using one of the following alternatives:
StringCbCat, StringCbCatEx, StringCbCatN, StringCbCatNEx, StringCchCat, StringCchCatEx, StringCchCatN, or StringCchCatNEx. You should review Security Considerations: Microsoft Windows Shell before continuing.
Function Information
Minimum DLL Version shlwapi.dll version 4.71 or later
Custom Implementation No
Header shlwapi.h
Import library shlwapi.lib
Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0
--------------------------------------------------------------------------------
© 2003 Microsoft Corporation. All rights reserved.
==================================================================================
Microsoft C Run-Time Library for Windows CE .NET
strcat, wcscatSee Also
strncat, strncmp, strncpy
Append a string.
Routine Required Header
strcat <string.h>
wcscat <string.h>
char *strcat( char *strDestination, const char *strSource );
wchar_t *wcscat( wchar_t *strDestination, const wchar_t *strSource );
Parameters
strDestination
Null-terminated destination string
strSource
Null-terminated source string
Libraries
All versions of the C run-time libraries.
Return Value
Each of these functions returns the destination string (strDestination). No return value is reserved to indicate an error.
Remarks
The strcat function appends strSource to strDestination and terminates the resulting string with a null character. The initial character
of strSource overwrites the terminating null character of strDestination. No overflow checking is performed when strings are copied or appended. The behavior of strcat is undefined if the source and
destination strings overlap.
wcscat is the wide-character version of strcat. The arguments and return value of wcscat are wide-character strings. These two functions
behave identically otherwise.
Security Remarks
The first argument, strDestination, must be large enough to hold the current strDestination and strSource combined and a closing '\0 ';
otherwise, a buffer overrun can occur. This may lead to a denial of service attack against the application if an access violation occurs, or in the worst case, allow an attacker to inject
executable code into your process. This is especially true if strDestination is a stack-based buffer. Consider using strncat or wcsncat
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE Defined
_tcscat wcscat
Example
/* STRCPY.C: This program uses strcpy
* and strcat to build a phrase.
*/
#include <string.h>
#include <stdio.h>
void main( void )
{
char string[80];
strcpy( string, "Hello world from " );
strcat( string, "strcpy " );
strcat( string, "and " );
strcat( string, "strcat! " );
printf( "String = %s\n ", string );
}
Output
String = Hello world from strcpy and strcat!
See Also
strncat, strncmp, strncpy
--------------------------------------------------------------------------------
Send feedback on this topic to Microsoft
© Microsoft Corporation. All rights reserved.
Topic Version 7.1.2277.1013
--------------------------------------------------------------------------------
Appends one string to another.
Syntax
LPTSTR StrCat( LPTSTR psz1,
LPCTSTR psz2
);
Parameters
psz1
[in, out] Pointer to a null-terminated string to which the function appends psz2. This buffer must be large enough to hold both strings
and the null terminator.
psz2
[in] Pointer to a null-terminated string to be appended to psz1.
Return Value
Returns a pointer to psz1, which holds the combined strings.
Remarks
Security Alert Using this function incorrectly can compromise the security of your application. The first argument, psz1, must be large
enough to hold psz2 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 psz1 is a stack-based buffer. Consider using one of the following alternatives:
StringCbCat, StringCbCatEx, StringCbCatN, StringCbCatNEx, StringCchCat, StringCchCatEx, StringCchCatN, or StringCchCatNEx. You should review Security Considerations: Microsoft Windows Shell before continuing.
Function Information
Minimum DLL Version shlwapi.dll version 4.71 or later
Custom Implementation No
Header shlwapi.h
Import library shlwapi.lib
Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0
--------------------------------------------------------------------------------
© 2003 Microsoft Corporation. All rights reserved.
==================================================================================
Microsoft C Run-Time Library for Windows CE .NET
strcat, wcscatSee Also
strncat, strncmp, strncpy
Append a string.
Routine Required Header
strcat <string.h>
wcscat <string.h>
char *strcat( char *strDestination, const char *strSource );
wchar_t *wcscat( wchar_t *strDestination, const wchar_t *strSource );
Parameters
strDestination
Null-terminated destination string
strSource
Null-terminated source string
Libraries
All versions of the C run-time libraries.
Return Value
Each of these functions returns the destination string (strDestination). No return value is reserved to indicate an error.
Remarks
The strcat function appends strSource to strDestination and terminates the resulting string with a null character. The initial character
of strSource overwrites the terminating null character of strDestination. No overflow checking is performed when strings are copied or appended. The behavior of strcat is undefined if the source and
destination strings overlap.
wcscat is the wide-character version of strcat. The arguments and return value of wcscat are wide-character strings. These two functions
behave identically otherwise.
Security Remarks
The first argument, strDestination, must be large enough to hold the current strDestination and strSource combined and a closing '\0 ';
otherwise, a buffer overrun can occur. This may lead to a denial of service attack against the application if an access violation occurs, or in the worst case, allow an attacker to inject
executable code into your process. This is especially true if strDestination is a stack-based buffer. Consider using strncat or wcsncat
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE Defined
_tcscat wcscat
Example
/* STRCPY.C: This program uses strcpy
* and strcat to build a phrase.
*/
#include <string.h>
#include <stdio.h>
void main( void )
{
char string[80];
strcpy( string, "Hello world from " );
strcat( string, "strcpy " );
strcat( string, "and " );
strcat( string, "strcat! " );
printf( "String = %s\n ", string );
}
Output
String = Hello world from strcpy and strcat!
See Also
strncat, strncmp, strncpy
--------------------------------------------------------------------------------
Send feedback on this topic to Microsoft
© Microsoft Corporation. All rights reserved.
Topic Version 7.1.2277.1013
相关文章推荐
- <shlwapi.h> StrCat(a1,a2);
- <python>string,list,tuple
- <LeetCode OJ> 345. Reverse Vowels of a String
- <python>string模块详解
- 入门计划->学用stl std::map<std::string, int>
- <细节>C++标准库string类型
- string.xml中的<xliff:g>标签
- <meta name="name" content="string">标签解析
- 一个分解字符串函数strtok 实现(不使用<string.h>)
- <string> 与 <string.h> 的区别
- <Java>使用String读取文件名称获取得定位置的字符串
- <C++>istringstream, ostringstream, stringstream的用法
- <c:if test="${fn:contains(name, searchString)}">
- <string>和<string.h>的区别?
- <string.h> && <string> && <cstring>
- <string> 与<string.h>、<cstring>的区别
- <string>VS<string.h>VS<cstring>
- <String>XX</String>类型的XML解析
- #include <string> <string.h> <cstring> 三者的区别
- 整理:CString类的完美总结&&CString 成员函数用法大全&&string 与 CString 转化&&<string><string.h> 和<cstring>的区别