如果我以这种方式在Windows中创建管道:
CreatePipe(hRead, hWrite, &sec_atr, NULL)
然后以这种方式从FILE *
制作hRead
:
int fd = _open_osfhandle((intptr_t)hRead, _O_RDONLY|_O_TEXT);
FILE *pipe_read = _fdopen(fd, "rt");
然后我应该如何关闭此文件(pipe_read
)?
fclose(pipe_read)
_pclose(pipe_read)
CloseHandle((HANDLE)_get_osfhandle(fileno(pipe_read)))