Re: Reading from pipes (Unix)



d93-mln@sm.luth.se writes:

| When using gdk_input_add to monitor a pipe for reading my callback
| function is called upon repeatedly. I only want it to be called once
| when there is new data to be read from the pipe. How do I do this??

Create the pipe:

  timer_fp = popen("timer", "r");

add it to the event loop:

  handle = gdk_input_add (fileno(timer_fp), GDK_INPUT_READ, update_frame, preview);

and read it in your callback:

  retval = read(fd, &pipe_data, sizeof(unsigned long));

fd is fileno(timer_fp)

-- 
http://www.ping.de/sites/aibon/



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