//获取温度节点
int getTemperature(){
char temp[64];
FILE *fp = NULL;
fp = fopen("/sys/devices/virtual/thermal/thermal_zone8/temp", "r");
int value = 0;
if(fgets(temp, sizeof(temp), fp) != NULL){
value = atoi(temp);
}
if(fp != NULL)
fclose(fp);
return value;
}
网友评论