Go to advanced search

by aturfer
Tue Jun 09, 2020 10:05 am
Forum: C/C++
Topic: Small fgetc() example not working on Raspberry Pi
Replies: 10
Views: 404

Re: Small fgetc() example not working on Raspberry Pi

WoW! Thanks for all the responses and valuable info! I'm working through the examples from a very old book. Everything makes sense now, and good to know about these compiler options - will use them going forward 8-)
by aturfer
Tue Jun 09, 2020 9:03 am
Forum: C/C++
Topic: Small fgetc() example not working on Raspberry Pi
Replies: 10
Views: 404

Small fgetc() example not working on Raspberry Pi

I came across a small fgetc() example that doesn't work on Raspberry Pi, but works on my desktop Linux: #include <stdio.h> int main(int argc, char *argv[]) { char c = 0; FILE *in = fopen("sometextfile.txt", "r"); while ((c = fgetc(in)) != EOF) { printf("%d\n", c); } fclose(in); return 0; } On both m...
by aturfer
Sat Jun 06, 2020 11:44 pm
Forum: Ubuntu
Topic: [ubuntu] Getting CPU tempature on Ubuntu
Replies: 13
Views: 12249

Re: Getting CPU tempature on Ubuntu

mallets wrote:
Thu Sep 19, 2019 4:02 am
I'm still searching for the CPU freq value though.

Current CPU frequency:

Code: Select all

echo ">> CPU Freq:" $(($(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)/1000))MHz

To get min/max CPU frequency range:

Code: Select all

lscpu | grep -i mhz
by aturfer
Sat Jun 06, 2020 11:12 pm
Forum: Ubuntu
Topic: [ubuntu] Getting CPU tempature on Ubuntu
Replies: 13
Views: 12249

Re: [ubuntu] Getting CPU tempature on Ubuntu

For those who feel like compiling something, create file temp.c with the following: #include <stdio.h> int main(int argc, char *argv[]) { FILE *fp; int temp = 0; fp = fopen("/sys/class/thermal/thermal_zone0/temp", "r"); fscanf(fp, "%d", &temp); printf(">> CPU Temp: %.2f°C\n", temp / 1000.0); fclose(...
by aturfer
Sat Feb 25, 2012 8:12 pm
Forum: Off topic discussion
Topic: Acta being pushed through
Replies: 7
Views: 1450

Re: Acta being pushed through

<r>I don't think ACTA is harmless. Here are my concerns:<br/> <br/> 1. Threat to British Innovation: investors will be reluctant to invest in UK Internet start-ups (this talk is on SOPA, but I believe the same applies to ACTA: <URL url="http://bigthink.com/ideas/42035">http://bigthink.com/ideas/4203...

Go to advanced search