I am looking for some function that will return the total capacity of a micro SD card mounted to /dev/sdb. I do not care so much about free space I care about total capacity of the drive. I need a reliable and accurate function. If there is none in existence how would I go about creating one?
Thanks!
strace for
blockdevtells me you could use:(replace sdx by device node name)
Note prefer using
uint64_tif your compiler supports it already (include<cstdint>)