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

13 lines
260 B
C

#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);
}