nice_size()
#
nice_size()
formats a byte count into a human-readable string with appropriate units (B, KB, MB, etc.), using either base-1000 or base-1024 scaling.
Prototype
void nice_size(
char *bf, size_t bfsize,
uint64_t bytes, BOOL b1024
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Buffer to store the formatted size string. |
|
|
Size of the buffer |
|
|
The number of bytes to format. |
|
|
If |
Return Value
None.
Notes
The function ensures that the formatted string fits within bfsize
and selects the most appropriate unit for readability.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples