Created
May 9, 2015 10:22
-
-
Save BlueCocoa/0f5492b9d85f07ec50a2 to your computer and use it in GitHub Desktop.
Get iOS storage size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import Darwin.sys.mount; | |
int main(int argc, const char * agrv[]) { | |
struct statfs buf; | |
long long freespace = 0; | |
if(statfs("/", &buf) >= 0){ | |
freespace = (long long)buf.f_bsize * buf.f_blocks; | |
} | |
if(statfs("/private/var", &buf) >= 0){ | |
freespace += (long long)buf.f_bsize * buf.f_blocks; | |
} | |
printf("%lld\n",freespace); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[Blog Link]
[Blog Link]:
https://blog.0xbbc.com/2015/05/获取ios的存储空间大小/