views:

302

answers:

1

I have a code that looks like this:

uses this library

#include <unistd.h>

#define READ_FD 0
#define WRITE_FD 1

int m_pipe[2]; 

if(pipe(m_pipe) != -1) {
   unsigned long Id = gdk_input_add(m_pipe[READ_FD], GDK_INPUT_READ, Callback, (gpointer)this);
}

and it surprisingly builds on both linux(all major flavors: AS3, AS5, solaris) and windows. However, it doesn't really work on windows at all.

How should a code using pipes be implemented so it works on both windows and linux?

Thanks

A: 

I would expose the upper functionality and not pipes themselves. On unix the lower level library code would use pipes but on some other machine it could use a different mechanism.

KPexEA