Oppure se devo usare per forza le label, c'è un modo per impostare il testo da stampare con segnaposti e più variabili come in una normale stampa video?
per esempio: printf("Testo: %s, %d\nTesto2: %s, %s", str, c, str2, c2)
Grazie



#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv){
int a, b, c;
GString *string;
GtkWidget *window, *label;
gtk_init(&argc, &argv);
/* inizializzo le le variabili */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
string = g_string_new(NULL);
a=1;
b=1;
c=a+b;
/* stampo il contenuto nella stringa si puo' fare anche con sprintf */
g_string_printf(string, "facciamo le somme\n%d+%d=%d", a, b, c);
/* setto il contenuto della stringa come testo della label */
label = gtk_label_new(string->str);
/* da qui in poi il testo e' nella label quindi libero la stringa */
g_string_free(string, TRUE);
gtk_container_add(GTK_CONTAINER(window), label);
gtk_widget_show_all(window);
gtk_main();
}




GString * g_string_append (GString *string,
const gchar *val);


GtkWidget* array[dim]


GtkWidget array[dim]GtkWidget* array
...
mystruct->array = ( GtkWidget* ) malloc ( N * sizeof ( GtkWidget ) );
...
// while
mystruct->array[i] = gtk_label_new ("Testo");
gtk_box_pack_start ( GTK_BOX ( mystruct->hboxs ), mystruct->array[i] , TRUE, TRUE, 0 );



