dotfiles/examples/statusbar items - C sources/mem.c

13 lines
260 B
C
Raw Normal View History

2021-09-07 20:53:41 +00:00
#include <stdio.h>
int main(void)
{
unsigned long long availmem;
FILE *fp;
fp = fopen("/proc/meminfo","r");
fscanf(fp,"%*s %*s %*s %*s %*s %*s %*s %llu", &availmem);
fclose(fp);
printf("%llu MB free\n",availmem/1024);
return(0);
}