20 lines
375 B
C
20 lines
375 B
C
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main(void){
|
||
|
FILE *fp;
|
||
|
char buffer[3];
|
||
|
int temp = 0;
|
||
|
|
||
|
fp = fopen("/sys/class/thermal/thermal_zone7/temp", "r");
|
||
|
fgets(buffer, sizeof buffer, (FILE*)fp);
|
||
|
fclose(fp);
|
||
|
|
||
|
buffer[strcspn(buffer, "\r\n")] = 0;
|
||
|
temp = atoi(buffer);
|
||
|
printf(" %d°C \n", temp);
|
||
|
|
||
|
return 0;
|
||
|
}
|