one question about glib
- From: "Leao" <jinmu190 163 com>
- To: "gtk-app-devel-list" <gtk-app-devel-list gnome org>
- Subject: one question about glib
- Date: Sun, 5 Jul 2009 20:04:06 +0800
Hello, List!
Recently, I am writing a little program with gtk+ on win32 platform. In this program I use
g_spawn_async_with_pipes(NULL,cmd_line,NULL,G_SPAWN_SEARCH_PATH,NULL,NULL,NULL,NULL,&std_out,NULL,NULL); to
call gcc and as a result the command line has executed successfully .However when I use
g_io_channel_reda_chars(channel,out,-1,&bytes_read,NULL) to get the standard out stored in out, it turns out
to be wrong.Here is my code :
gchar *cmd_line[] = {"gcc","-o","temp.exe","temp.c","-mms-bitfields", "-lgtk-win32-2.0",
"-lgdk-win32-2.0", "-latk-1.0", "-lgdk_pixbuf-2.0", "-lpangowin32-1.0", "-lgdi32" ,"-lpango-1.0"
,"-lgobject-2.0" ,"-lgmodule-2.0", "-lglib-2.0" ,"-lintl"};
gchar out[1024];
GIOChannel *channel;
gint std_out = 0;
gint bytes_read;
g_spawn_async_with_pipes(NULL,cmd_line,NULL,G_SPAWN_SEARCH_PATH,NULL,NULL,NULL,NULL,&std_out,NULL,NULL);
channel = g_io_channel_unix_new(std_out);
g_io_channel_read_chars(channel,out,-1,&bytes_read,NULL);
If I want to get the standard out ,what should I do?
Any info is appreciated ! :)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]