StringCbPrintf 函数

来源:互联网 发布:暗黑破坏神2mac中文版 编辑:程序博客网 时间:2024/04/28 19:29

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 is a replacement for the following functions:

StringCbPrintf是一个代替一下函数的函数

  • sprintf, swprintf, _stprintf
  • wsprintf
  • wnsprintf
  • _snprintf, _snwprintf, _sntprintf

Syntax 语法

C++
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).

目标缓存的字节大小。这个值必须足够大。

pszFormat [in]

Type: LPCTSTR

The format string. This string must be null-terminated.

格式字符串。这个字符串必须为空字符终止。

... [in]

The arguments to be inserted into the pszFormat string.

被插入到格式字符串里的参数。

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.
这个函数会返回一个跟随值,它可以表明你使用这个函数是否成功。
原创粉丝点击