Re: g_signal_connect: where is?



i m new to gtk programming and now in big trouble. i m using the 
following function to pass parameters

void okpressed()
{
   char *ent1 = "111.111.111.1";
   char *ent2 = "512";
   char command[3];
   command[0] = ent1;
   command[1] = ent2;
   system("./script command");
}

I really don't understand what you are trying to do.. 

Maybe this? :

void okpressed()
{
   gchar *ent1 = "111.111.111.1";
   gchar *ent2 = "512";
   gchar *command = g_strdup_printf
        ("./script \"%s\" \"%s\"",ent1, ent2);
   system(command);

   g_free(command);
}

Also check out this API :
http://developer.gnome.org/doc/API/2.0/glib/glib-Spawning-Processes.html

Example :

void okpressed() {
   GError *error;
   gchar *ent1 = "111.111.111.1";
   gchar *ent2 = "512";
   gchar *command = 
        g_strdup_printf("./script \"%s\" \"%s\"",ent1, ent2);

   if (!g_spawn_command_line_async (command, &error)) {
        g_print("Failure\n");
   }

   g_free(command);
}

here i m actually calling a script. the same function is executed 
if values are sent to it directly.


-- 
Philip van Hoof aka freax (http://www.freax.eu.org)
irc: irc.openprojects.net mailto:me at freax dot org
Go not to the Elves for counsel, for they will say both no and yes.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]