gdk_input_add() question



I've started playing with gdk_input_add() and have a simple question. I
opened a pipe for reading using popen() and attached a listener to the
descriptor. The listener gets called but no data is ever available.

#include <stdio.h>
#include <gtk/gtk.h>

void reader(gpointer data, gint source, GdkInputCondition condition)
{
    char buf[1024];

    if (read(buf, 1024, source) > 0) {
        printf("buf: %s\n", buf);
    }
}

int main()
{
    int fd;
    FILE *fp;

    fp = popen("date;sleep 1;date", "r");
    fd = fileno(fp);
    gdk_input_add(fd, GDK_INPUT_READ, reader, NULL);

    gtk_main();

    pclose(fp);

    return 0;
}

Any hints?

-Andrei

We all have photographic memories, it's just
that some of us don't have any film.



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