Re: auto refresh file in textview



Please ignore the previous post. google is giving some hints.
I will comeback if I failed.
On Fri, 2012-08-24 at 14:41 +0100, Rudra Banerjee wrote:
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


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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