How to save TextView data to file?



Trying to write a small notepad app.  Data has been read in from
a file and edited. How can the text buffer be saved back to a file? 

(been reading GTK+ Reference Manual but misunderstanding something)

--------------------------------------
my $text_view = Gtk2::TextView->new;
my $text_buffer = $text_view->get_buffer;
my $iter = $text_buffer->get_iter_at_offset(0);

open(IN,"input");
while (<IN>) {
        $text_buffer->insert($iter, $_);
}
..<save key pressed> ...
open (OUT,">output");
..
$iter = $text_buffer->get_iter_at_offset(0);
print(OUT $text_buffer->get_text(1,20,FALSE));

----------------------------------------------

(using Szilveszter's latest debs)
bash-2.05b$ ./textview
expected a blessed reference at ./textview line 70, <IN> line 3.

Thank you.

Jeff



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