Re: GtkTextBuffer: how to insert new line?



On Fri, Jan 28, 2005 at 12:28:06AM +0100, Felix Kater wrote:
Paolo Costabel:

I just tried this:

    gtk_text_buffer_insert_at_cursor(buffer, "\n\n\n\n", 4);

and works fine here (gtk 2.4.10).

What call are you using?

Hm. 

a)

First I used gtk_text_buffer_insert_at_cursor(buffer, "\n\0", -1);
This didn't work (maybe the 0 termination is not right this way?)
To a function expecting to see a null terminator the explicit \0 is
completely benign, though unnecessary.


b)

then I just tried gtk_text_buffer_insert_at_cursor(buffer, "\n", -1);
which is of course wrong for what I realize now (missing 0 termination).

No, that's not true. In C, a string literal has an implicit terminator.

-jkl



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