Periodic Timer


I’m trying to use a periodic timer, and it’s working.
However, when I try to use the function system(for any command) it doesn’t work, like this:

rcvid = MsgReceive (myTemp.canal, &msg, sizeof (msg), NULL);

if (rcvid == 0)
	time (&now);
	printf ("Got a Pulse at %s", ctime (&now));
           [color=red] system("df"); 


So, I would like to know if there’s a way to make it work, or another way to do it.


What is not working?



work if you just embed it in a program without waiting for the time?

How do you run your program, from a console or in the background? Does this happen with other programs, eg. system(“ls”)? My guess is that your stdout is going to the wrong place, and df inherits this. You might want to try as a test:

df(“df >/dev/con1”);

and see if it shows up there.

Alternatively try

$ stty
Name: /dev/tty-xyz

and then put in system(“df >/dev/tty-xyz”);

Sorry, but I was using my coworker login!

Actually I think the problem is configuration of the timer.

if ((channel= ChannelCreate (0)) == -1)
printf (“Não criou o canal\n”);
return false;

system(“ls”); //IT WORKS!!

coid = ConnectAttach (0, 0, canal, 0, 0);
if (coid == -1) {
printf (“Não fez a conexao\n”);
return false;

system(“ls”); //IT DOESN’T WORK

So, the function system() stops working after I try to establish a connection between a process and a channel (ConnectAttach).