Re: help needed urgently



On Wed, 2002-11-13 at 19:35, nilesh wrote:
hello,

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 <spam freax be>
Anti Spam Account




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