g_spawn_async_with_pipes problems



hello,
I'm having two problems using
g_spawn_async_with_pipes, One is that when I try to
use the GError **error parameter. gcc reports a error
that says, "spawn.c:47: storage size of 'Child_Error'
isn't known".  How do I fix that?

The other problem I'm having is when I run a argument
counter program it reports that it got 8 arguments
which are "./argcounter" "a" "b" "c" "1" "2" 3"
"garbage", when I only passed it 7 arguments. Is that
a problem in g_spawn_async_with_pipes or am I doing
something wrong?

source snippit:

/*spawn program*/
gint Child_Process=0;
gint Child_Out=0, Child_Err=0;
struct GError Child_Error;
gchar *Child_Argv[]={ "./argcounter", "a", "b", "c",
"1", "2", "3" };

gint Bytes_Read=0;
gchar Read_Data[300];

g_spawn_async_with_pipes(NULL, Child_Argv, NULL,
G_SPAWN_SEARCH_PATH | G_SPAWN_FILE_AND_ARGV_ZERO,
NULL, NULL, &Child_Process, NULL, &Child_Out,
&Child_Err, Child_Error);

gint Bytes_Read=0;
gchar Read_Data[300];

Bytes_Read = read(Child_Out, Read_Data, 300);

g_print("spawn-Here Is What I Got From
Child(%06d):\n", Child_Process);
g_print("spawn-%s\n", Read_Data);


/*argcounter program*/
int main(int argc, char *argv[])
{
        int a=0;
        
        printf("argcounter-I Got %02d Arguments They Are:\n",
argc);
        
        for(a=0; a<argc; a++)
                printf("argcounter-\t%02d\t%s\n", a, argv[a]);
        
        printf("argcounter-Done\n");
        
        return(0);
}

source snippit end:

Thanks,
Mjaz

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



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