1、shell操作
cat /sys/class/thermal/thermal_zone0/temp
2、C语言文件IO操作
zw@ubuntu:~/Work/OpwnWrt_Src/Get_CPU_Temp$ cat Get_Temp.c
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define TEMP_PATH "/sys/class/thermal/thermal_zone0/temp"
#define MAX_SIZE 32
double get_cpu_temp()
{
int fd;
double temp=-1;
char buf[MAX_SIZE];
fd = open(TEMP_PATH, O_RDONLY);
if (fd < 0)
{
&nb

最低0.47元/天 解锁文章
8521

被折叠的 条评论
为什么被折叠?



