原文:
Writes formatted data to the specified string. The size of the destination buffer is provided to the function to ensure that it does not write past the end of this buffer.
将有格式的数据写进指定的字符串中。目标缓冲区的大小是为了确保不会在写入缓存时溢出。
StringCbPrintf_l is similar to StringCbPrintf but includes a parameter for locale information.
String CbPrintf_l 与 StringCbPrintf类似,但它包括了一个现场参数。
Syntax 语法
HRESULT StringCbPrintf( _Out_ LPTSTR pszDest, _In_ size_t cbDest, _In_ LPCTSTR pszFormat, _In_ ... );
Parameters 参数
-
pszDest [out]
-
Type: LPTSTR
The destination buffer, which receives the formatted, null-terminated string created from pszFormat and its arguments.
目标缓存。接收的格式,从pszFormat和它的参数创建的空字符。
cbDest [in]
-
Type: size_t
The size of the destination buffer, in bytes. This value must be sufficiently large to accommodate the final formatted string plus the terminating null character. The maximum number of bytes allowed is
STRSAFE_MAX_CCH * sizeof(TCHAR)
.目标缓存的字节大小。这个值必须足够大去容纳格式字符串最后附加的null空字符。允许最大的字节数为STRSAFE_MAX_CCH * sizeof(TCHAR).
pszFormat [in]
-
Type: LPCTSTR
The format string. This string must be null-terminated.
格式字符串。这个字符串必须以null结束。
... [in]
-
The arguments to be inserted into the pszFormat string.
被插入到pszFormat字符串的参数。
Return value
Type: HRESULT
This function can return one of the following values. It is strongly recommended that you use the SUCCEEDED and FAILED macros to test the return value of this function.
这个函数返回一个跟随值,这个值可以让你知道是否成功。
Return code | Description |
---|---|
| There was sufficient space for the result to be copied to pszDest without truncation, and the buffer is null-terminated. |
| The value in cbDest is either 0 or larger than |
| The copy 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. |
Note that this function returns an HRESULT value, unlike the functions that it replaces.
注意:这个函数返回一个HRESULT值。