You are not logged in.
I am thinking about writing a program that gets data from /proc and displays it in the console, maby expand it to a widget or something later. My questions are as follows:
A) How would I get the program to update the information every x seconds, and if I did do that, would it cause problems? Even if I closed the "file" after every loop?
Offline
What language? In bash its sleep num, python time.sleep(num), C Sleep(num) (? {or is that from windows.h} [hell I don't know])
Shouldn't cause any problems, just makes your system wait x amount of seconds.
Offline
I presume you are using C/C++, then there is sleep and usleep I think it's in unistd.h, try man 3 sleep.
But almost in any other language you can find something simmilar.
However the nicest implementation would be to subscribe to notifications from fam, and this way your program will be notified when something changes in /proc filesystem, so you won't be wasting CPU cicles by rescaning every 2 seconds all /proc entries.
Offline
Thanks. What I was wonder what would be a problem is scanning /proc for new information every x seconds(I'm thinking 30 seconds might be good enough, maby 25).
And how would I use fam? Also, g++ doesn't seem to know what "string" is. I did include <string> but it says "string needs a type"
EDITED
Offline
#include <strings> and man string will give you all the info you need. To use fam you ned to read the fam documentation.
Offline