Interprocess communication via pipes, Memory I/O
Posted: 17-Jul-2024, 21:36
Code: Select all
HANDLE hReadPipe;
HANDLE hWritePipe;
CreatePipe(&hReadPipe, &hWritePipe , 0, 0);
WriteFile(hWritePipe, "hello", 5, 0, 0);
int sz = GetFileSize(hReadPipe, 0);
assert(sz == 5);
char out[5];
ReadFile(hReadPipe, out, 5, 0,0);
See: _open_osfhandle() and _get_osfhandle() and _fdopen() to get FILE*.