Non-blocking pipe using popen?

后端 未结 3 1628
清歌不尽
清歌不尽 2020-12-04 20:16

I\'d like to open a pipe using popen() and have non-blocking \'read\' access to it.

How can I achieve this?

(The examples I found were all blocking/synchrono

3条回答
  •  执念已碎
    2020-12-04 20:57

    Never tried it but I don't see why you couldn't grab the file descriptors with fileno(), use fcntl() to set to non-blocking, and use read()/write(). Worth a try.

提交回复
热议问题