Display string with newline characters in GtkTextView

125 Views Asked by At

I used this code to display string to a GtkTextView object:

btsel(database, word, meaning, 50000, &rsize); //B-tree
gtk_text_buffer_set_text(buffer, meaning, -1);

Problem is that it showed the entire string without parsing the newline characters, the result ended up like this:

Nguyễn\nAnh\nTuấn

At first i thought the prolem was the use of Unicode characters, so i tried using the following code to test if it was true:

strcpy(buffer, "Nguyễn\nAnh\nTuấn");
gtk_text_buffer_set_text(buffer, meaning, -1);

And this time the result was:

Nguyễn
Anh
Tuấn

After hours searching Google in vain, i ended up here. Pls help me, and thank you in advance (^^

My bad English.

0

There are 0 best solutions below