StrFormatByteSizeA Function

Converts a numeric value into a string that represents the number expressed as a size value in bytes, kilobytes, megabytes, or gigabytes, depending on the size. Differs from StrFormatByteSizeW in one parameter type.

Syntax

LPSTR StrFormatByteSizeA(      
    DWORD dw,     LPSTR pszBuf,     UINT cchBuf );

Parameters

dw
[in] The numeric value to be converted.
pszBuf
[out] A pointer to a buffer that receives the converted string.
cchBuf
[in] The size of pszBuf, in characters.

Return Value

Returns the address of the converted string, or NULL if the conversion fails.

Remarks

The first parameter of this function has a different type for the ANSI and Unicode versions. If your numeric value is a DWORD, you can use StrFormatByteSize with text macros for both cases. The compiler will cast the numerical value to a LONGLONG for the Unicode case. If your numerical value is a LONGLONG, you should use StrFormatByteSizeW explicitly.

Example

       532 -> 532 bytes
      1340 -> 1.3KB
     23506 -> 23.5KB
   2400016 -> 2.4MB
2400000000 -> 2.4GB

Function Information

Minimum DLL Versionshlwapi.dll version 4.71 or later
Custom ImplementationNo
Headershlwapi.h
Import libraryshlwapi.lib
Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0

See Also

Tags :


Page view tracker