Export (0) Print
Expand All

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


PSTR StrFormatByteSizeA(
  DWORD dw,
  _Out_  PSTR pszBuf,
  UINT cchBuf
);

Parameters

dw

Type: DWORD

The numeric value to be converted.

pszBuf [out]

Type: PSTR

A pointer to a buffer that receives the converted string.

cchBuf

Type: UINT

The size of the buffer pointed to by pszBuf, in characters.

Return value

Type: PSTR

Returns a pointer to 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.

The following table illustrates how this function converts a numeric value into a text string.

Numeric valueText string
532532 bytes
13401.30 KB
2350622.9 KB
24000162.28 MB
24000000002.23 GB

 

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 4.71 or later)

See also

StrFormatByteSize64
StrFormatByteSizeEx
StrFormatByteSizeW

 

 

Community Additions

ADD
Show:
© 2014 Microsoft