Это эквивалентный код в C: < /p>
Код: Выделить всё
int tempeture(){
FILE *file = fopen("/sys/class/thermal/thermal_zone0/temp", "r");
if (!file) {
perror("Failed to open temp file");
return 1;
}
int temp;
fscanf(file, "%d", &temp);
fclose(file);
printf("CPU Temperature: %.2f°C\n", temp / 1000.0);
return 0;
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... osix-shell
Мобильная версия