How can I print (for example in a label) the text into a GtkTextView? For GtkLabel and GtkEntry there are gtk_label_get_text() and gtk_entry_get_text(), but for GtkTextView?
A:
You can:
GtkTextIter start, end;
GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view);
gchar *text;
gtk_text_buffer_get_bounds (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
Don't forget to g_free (text)
when no longer needed.
doublep
2010-05-14 16:02:20
If I use char *text?
stdio
2010-05-14 16:28:57
`gchar` is the same as `char`, so you can use `char*` just as well.
doublep
2010-05-14 19:49:00