Re: auto refresh file in textview
- From: Rudra Banerjee <bnrj rudra yahoo com>
- To: jcupitt gmail com
- Cc: gtk devel <gtk-app-devel-list gnome org>
- Subject: Re: auto refresh file in textview
- Date: Fri, 24 Aug 2012 14:41:23 +0100
I am sorry but I really don't know how to write on a buffer.
I am writing on the file as:
FILE *fop = fopen(filename, "a" );
g_fprintf( fop, "@%s{%s,\n", strcombo, strkey );
g_fprintf( fop, "\tAuthor=%s,\n", strAuth);
etc. and the buffer is defined as
static void read_view(char *inpfn) {
char *buffer;
stat(inpfn, &filestat);
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
buffer = (char *) malloc(filestat.st_size * sizeof (char));
efile = fopen(inpfn, "r");
fread(buffer, filestat.st_size, 1, efile);
gtk_text_buffer_set_text(textbuffer, buffer, filestat.st_size);
free(buffer);
}
Can you please give me a hint how to write on a buffer? I am a novice,
hope you will be kind.
On Fri, 2012-08-24 at 13:33 +0100, jcupitt gmail com wrote:
Hi Rudra,
On 23 August 2012 13:45, Rudra Banerjee <bnrj rudra yahoo com> wrote:
whenever I am writing, it is saved, but to see the change, I have to
reopen the file(obviously).
What do you need to know? Do you want your textview to update as the
file changes?
If your program is appending to the file as well as displaying in the
textview, it would be much simpler just to append to the textview
itself.
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]