Function

GLibformat_size_for_display

deprecated: 2.30 since: 2.16

Declaration [src]

gchar*
g_format_size_for_display (
  goffset size
)

Description [src]

Formats a size (for example the size of a file) into a human readable string. Sizes are rounded to the nearest size prefix (KB, MB, GB) and are displayed rounded to the nearest tenth. E.g. the file size 3292528 bytes will be converted into the string “3.1 MB”.

The prefix units base is 1024 (i.e. 1 KB is 1024 bytes).

This string should be freed with g_free() when not needed any longer.

Available since: 2.16

Deprecated since: 2.30

This function is broken due to its use of SI suffixes to denote IEC units. Use g_format_size() instead.

Parameters

size

Type: goffset

A size in bytes.

Return value

Type: gchar*

A newly-allocated formatted string containing a human readable file size.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.