Re: printf redirection to GTK window



On Fri, Mar 22, 2002 at 10:42:07AM +0100, Petro Verheuvel wrote:
Hi all,

I was wondering if it is possible to redirect printf()/stdout to a window that has been created with
GTK?

Thx for answering,

Petro Verheuvel
---end quoted text---

instead using printf, use g_print and set it's handler throught
g_set_print_handler () to a your own function that will just put it on the
label that you wants..
glib documentation says: (gtk is based on glib, so no new dependencies..)

g_set_print_handler ()

GPrintFunc  g_set_print_handler             (GPrintFunc func);

Sets the print handler. Any messages passed to g_print() will be output via the
new handler. The default handler simply outputs the message to stdout. By
providing your own handler you can redirect the output, to a GTK widget or a
log file for example.

          func : the new print handler.

       Returns : the old print handler.

-------
GPrintFunc ()

void        (*GPrintFunc)                   (const gchar *string);

Specifies the type of the print handler functions. These are called with the
complete formatted string to output.

        string : the message to be output.


Hope that it helped,
[]'s
-- 
Marcelo R Leitner <mrl netbank com br>
ICQ #: 29966851



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