网站首页  词典首页

请输入您要查询的函数:

 

术语 stringcbcat
释义 StringCbCat
语法:
HRESULT StringCbCat( LPTSTR pszDest,
size_t cbDest,
LPCTSTR pszSrc
);
StringCbCat功能
StringCbCat连接两个字符串。该StringCbCat strcat的功能及其相关变体的替代品。大小,以字节为目标缓冲区提供的功能,以确保不会写入StringCbCat过去这个缓冲区的末尾。
参数
pszDest
[中,out]指向一个缓冲区包含哪些pszSrc字符串连接在一起,并包含整个结果字符串。在pszSrc字符串添加到在pszDest字符串的结尾。
cbDest
[in]的目标缓冲区的大小,以字节为单位。此值必须考虑pszSrc加上pszDest加上终止空字符长度。所允许的最大字节数为STRSAFE_MAX_CCH * sizeof(TCHAR)。
pszSrc
[in]指向一个缓冲区包含源字符串连接在一起的pszDest结束。此源字符串必须空终止。
返回值
这种注意,函数返回,而不是strcat,它返回一个指针的hresult。我们强烈建议您使用的成功和失败宏来测试这个函数的返回值。
S_OKSource数据目前,字符串串联没有完全截断,并由此产生的目标缓冲区是空终止。
STRSAFE_E_INVALID_PARAMETERThe价值cbDest要么是0,超过最大允许值,或低于pszDest实际大小小大。
STRSAFE_E_INSUFFICIENT_BUFFERThe串联操作失败,由于没有足够的缓冲空间。目标缓冲区包含了预期的结果被截断,空终止的版本。截断的情况下是可以接受的,这未必是一个失败的情况出现。
备注
StringCbCat提供了代码中的适当缓冲处理额外的处理。可怜的缓冲处理是牵连,许多安全问题涉及缓冲区溢出。它总是空终止一个非零长度目标缓冲区。
StringCbCat可以用在它的通用形式,或作为StringCbCatA特别(为ANSI字符串)或StringCbCatW(为Unicode字符串)。该表格使用取决于您的数据。
字符串数据String类型LiteralFunction
字符“字符串”StringCbCatA
TCHARTEXT(“字符串”)StringCbCat
WCHARL“字符串中”StringCbCatW
StringCbCat及其ANSI和Unicode的变种替换这些功能:
strcat
wcscat
lstrcat
strcat
StrCatBuff
_tcscat
_ftcscat
行为是未定义如果字符串指向pszSrc和pszDest重叠。
无论pszSrc也不pszDest应为NULL。见StringCbCatEx如果您需要的空字符串指针值的处理。
功能信息
Headerstrsafe.h
import librarystrsafe.lib
参见
StringCchCat,StringCbCatEx,StringCbCatN
==英文原文==StringCbCat Function
StringCbCat concatenates two strings. The StringCbCat functions are replacements for strcat and its related variants. The size, in bytes, of the destination buffer is provided to the function to ensure that StringCbCat does not write past the end of this buffer.
Syntax
HRESULT StringCbCat( LPTSTR pszDest,
size_t cbDest,
LPCTSTR pszSrc
);
Parameters
pszDest
[in, out] Pointer to a buffer containing the string to which pszSrc is concatenated, and which contains the entire resultant string. The string at pszSrc is added to the end of the string at pszDest.
cbDest
[in] Size of the destination buffer, in bytes. This value must consider the length of pszSrc plus the length of pszDest plus the terminating null character. The maximum number of bytes allowed is STRSAFE_MAX_CCH * sizeof(TCHAR).
pszSrc
[in] Pointer to a buffer containing the source string that is concatenated to the end of pszDest. This source string must be null-terminated.
Return Value
Note that this function returns an HRESULT as opposed to strcat, which returns a pointer. It is strongly recommended that you use the SUCCEEDED and FAILED macros to test the return value of this function.
S_OKSource data was present, the strings were fully concatenated without truncation, and the resultant destination buffer is null-terminated.
STRSAFE_E_INVALID_PARAMETERThe value in cbDest is either 0, larger than the maximum allowed value, or smaller than the actual size of pszDest.
STRSAFE_E_INSUFFICIENT_BUFFERThe concatenation operation failed due to insufficient buffer space. The destination buffer contains a truncated, null-terminated version of the intended result. In situations where truncation is acceptable, this may not necessarily be seen as a failure condition.
Remarks
StringCbCat provides additional processing for proper buffer handling in your code. Poor buffer handling is implicated in many security issues that involve buffer overruns. It always null-terminates a non-zero-length destination buffer.
StringCbCat can be used in its generic form, or specifically as StringCbCatA (for ANSI strings) or StringCbCatW (for Unicode strings). The form to use is determined by your data.
String Data TypeString LiteralFunction
char"string"StringCbCatA
TCHARTEXT("string")StringCbCat
WCHARL"string"StringCbCatW
StringCbCat and its ANSI and Unicode variants are replacements for these functions:
strcat
wcscat
lstrcat
strcat
StrCatBuff
_tcscat
_ftcscat
Behavior is undefined if the strings pointed to by pszSrc and pszDest overlap.
Neither pszSrc nor pszDest should be NULL. See StringCbCatEx if you require the handling of null string pointer values.
Function Information
Headerstrsafe.h
Import librarystrsafe.lib
See Also
StringCchCat , StringCbCatEx , StringCbCatN
==原始网址==http://msdn.microsoft.com/en-us/library/ms647495(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:21:32