/*********************************************************** * Filename: temp.c * * A program to measure the processor temperature on the * RaspberryPi. * * Compile with the command: gcc -o temp temp.c * * Execute with the command: ./temp * **********************************************************/ #include #include int infile; float temp1; int main() { FILE *infile; infile = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); fscanf(infile, "%f",&temp1); temp1/=1000; printf("%.1f C\n", temp1); return 0; }