StringCbPrintf_l 函式

pamxy發表於2013-04-10

原文:

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
S_OK

There was sufficient space for the result to be copied to pszDest without truncation, and the buffer is null-terminated.

STRSAFE_E_INVALID_PARAMETER

The value in cbDest is either 0 or larger than STRSAFE_MAX_CCH * sizeof(TCHAR).

STRSAFE_E_INSUFFICIENT_BUFFER

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值。


相關文章