|
CardSight 0.1.0
C API reference for the CardSight firmware and application
|
Capacity display in the decimal units a card is sold in: 1 kB is 1000 bytes, so a 32 GB card reads "32 GB" rather than "29.7 GiB". More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Functions | |
| void | format_capacity (uint64_t bytes, char *buffer, size_t size) |
| Write a decimal capacity into a buffer. | |
Capacity display in the decimal units a card is sold in: 1 kB is 1000 bytes, so a 32 GB card reads "32 GB" rather than "29.7 GiB".
| void format_capacity | ( | uint64_t | bytes, |
| char * | buffer, | ||
| size_t | size ) |
Write a decimal capacity into a buffer.
Picks TB, GB, MB, kB or B from the magnitude and rounds to the nearest whole unit, so a 32 GB card reads "32 GB" and a 512 MB one "512 MB".
| [in] | bytes | Capacity in bytes. |
| [out] | buffer | Destination string. |
| [in] | size | Size of buffer in bytes; nothing is written when zero. |