请教下windows下的管道操作.
我主要取得文件描述符Linux/Unix下:
pipe(pipeline); write(pipeline[1], data_source, data_source_len); pipeline[0] <- 取得文件描述符windows下我用CreatePipe咋都实现不了
感觉linux下pipe非阻塞的
windows下CreatePipe后WriteFile后就阻塞住了
查资料要创建进程, 可是捣鼓一通也不行是否能像下面这样不创建进程?
程序代码:
HANDLE piperead, pipewrite; SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; if (!CreatePipe(&piperead, &pipewrite, &sa, 0)) { return NULL; } if (!WriteFile(pipewrite, data_source, data_source_len, NULL, NULL)) { return NULL; } int file_des = _open_osfhandle((zend_intptr_t)piperead, 0); <- 取得文件描述符