Posted: Tue Apr 01, 2008 9:00 pm Post subject: [SOLVED] g_timeout_add runs function only once
Hello everybody!
I use g_timeout_add to run the following code once per second:
Code: (C)
1 2 3 4 5 6 7 8 9 10 11 12
void update (void)
{
FILE *output;
// char temp[100];
output = popen("ls", "r");
// save output to temp char
pclose(output);
g_print ("Hello World\n");
return;
}
This will (of course) print useless "Hello World"s to the command line ...
The problem is that if I uncomment line 4 I'll only get one "Hello World"! It seems that the code only gets executed once ... what's the problem with chars and g_timeout_add?
Thank you for your help!
Last edited by Zarg on Wed Apr 02, 2008 5:47 am; edited 1 time in total
update() function must be gboolean. It should return TRUE if timeout loop must be repeated. And your function returns random value that depends on register eax (on i8086) value.