StrFormatKBSizeW function (shlwapi.h)

Converts a numeric value into a string that represents the number expressed as a size value in kilobytes.

Syntax

PWSTR StrFormatKBSizeW(
        LONGLONG qdw,
  [out] PWSTR    pszBuf,
        UINT     cchBuf
);

Parameters

qdw

Type: LONGLONG

The numeric value to be converted.

[out] pszBuf

Type: PTSTR

A pointer to a buffer that, when this function returns successfully, receives the converted number.

cchBuf

Type: UINT

The size of pszBuf, in characters.

Return value

Type: PTSTR

Returns a pointer to the converted string, or NULL if the conversion fails.

Remarks

In Windows 10, size is reported in base 10 rather than base 2. For example, 1 KB is 1000 bytes rather than 1024.

Note

The shlwapi.h header defines StrFormatKBSize as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 5.0 or later)

See also

StrFormatByteSizeA

StrFormatByteSizeW