dockapps/wmacpiload-0.1.2/src/battest.c
Carlos R. Mafra 21625f40b5 Initial dockapps git repo
I tried to get the latest versions from dockapps.org, but I haven't
tested any of them.

More dockapps will be added as time permits.
2011-03-25 19:45:13 +01:00

24 lines
416 B
C

#include <stdio.h>
int i;
FILE *fd;
int temp;
char *buf;
main() {
buf=(char *)malloc(sizeof(char)*512);
for (i=0;i<20000;i++) {
if ((fd = fopen("/proc/acpi/battery/BAT0/state", "r"))) {
bzero(buf, 512);
fseek(fd,57,0);
fscanf(fd, "charging state: %s", buf);
printf("We are at loop %d and charging is %s\n",i,buf);
fclose(fd);
}
}
free(buf);
}