View topic - Periodic Timer
Periodic Timer
4 posts
• Page 1 of 1
Periodic Timer
Hi!
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:
for(;;)
{
rcvid = MsgReceive (myTemp.canal, &msg, sizeof (msg), NULL);
if (rcvid == 0)
{
time (&now);
printf ("Got a Pulse at %s", ctime (&now));
system("df");
}
}
So, I would like to know if there's a way to make it work, or another way to do it.
Thanks!
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:
for(;;)
{
rcvid = MsgReceive (myTemp.canal, &msg, sizeof (msg), NULL);
if (rcvid == 0)
{
time (&now);
printf ("Got a Pulse at %s", ctime (&now));
system("df");
}
}
So, I would like to know if there's a way to make it work, or another way to do it.
Thanks!
- diogo_angnalo
- Active Member
- Posts: 38
- Joined: Tue Feb 17, 2009 4:57 pm
RE: Periodic Timer
What is not working?
- mario
- QNX Master
- Posts: 4132
- Joined: Sun Sep 01, 2002 1:04 am
RE: Periodic Timer
Does
system("df")
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");
system("df")
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");
- maschoen
- QNX Master
- Posts: 2728
- Joined: Wed Jun 25, 2003 5:18 pm
RE: Periodic Timer
Hi!
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).
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).
- natalia_cristina
- New Member
- Posts: 1
- Joined: Sat Nov 21, 2009 5:50 pm
- Location: SP, Brazil
4 posts
• Page 1 of 1
Return to Realtime and Embedded
Who is online
Users browsing this forum: No registered users and 2 guests