Re: one question about glib



When replying to a message on a mailing list (especially one about
Open Source software), please reply to the mailing list, not to the
message sender. The very point with public mailing lists is that
discussion threads are kept public and archived for others to see. I
am adding gtk-app-devel-list back to Cc.

The development environment configutation was correct and the output file
can execute successuflly.

Can you explain how that can be true, i.e. where did you install
(copy) the headers and import libraries of the GTK+ stack? Just out of
interest.

But  the character string out returned by
g_io_channel_read_chars(channel,out,-1,&bytes_read,NULL) was empty

g_io_channel_read_chars() doesn't return a string. It returns a
GIOStatus. But yeah, I know what you mean. I hope...

As I said, a successfull run of gcc to compile and link a single
source file with no warnings doesn't print anything to standard
output. Just run the command manually and you will see that nothing is
printed. So why does it surprise you that nothing is written to the
standard output pipe then?

By the way, there is at least one serious problem in your code. You
pass -1 as the size of the buffer to g_io_channel_read_chars(). So of
course there will never be anything stored in the buffer. But even if
one fixes this and passes sizeof(out) instead, nothing is read, as
nothing is written. It would be better to use
g_io_channel_read_to_end() in this case, though.

nothing returned from this function.

Of course the function returns something. It is impossible in C for a
non-void function to not return anything. But yeah, I am just teasing
you. Sorry for that.

Which functions should I use ?

Well, unless you want to do asynchronous stuff or other niceties,
what's wrong with system() or popen()?

--tml



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