I tried to use the handle hPipe
as following the example here:
hPipe = CreateNamedPipe(
lpszPipename, // pipe name
PIPE_ACCESS_DUPLEX, // read/write access
PIPE_TYPE_MESSAGE | // message type pipe
PIPE_READMODE_MESSAGE | // message-read mode
PIPE_WAIT, // blocking mode
PIPE_UNLIMITED_INSTANCES, // max. instances
BUFSIZE, // output buffer size
BUFSIZE, // input buffer size
0, // client time-out
NULL);
ZeroCopyOutputStream* raw_output = new FileOutputStream(hPipe);
CodedOutputStream* coded_output = new CodedOutputStream(raw_output);
But get an error:
'google::protobuf::io::FileOutputStream::FileOutputStream(int,int)' : cannot convert parameter 1 from 'HANDLE' to 'int'
And here's the signature:
FileOutputStream(int file_descriptor, int block_size = -1);
So how to convert a handle to file_descriptor in c++?
UPDATE
I tried the recommended _open_osfhandle
but seems not correct, reporting:
error C2664: '_open_osfhandle' : cannot convert parameter 1 from 'HANDLE' to 'intptr_t'