Windows 如何:监视管道中数据的进度?
使用1MB管道:Windows 如何:监视管道中数据的进度?,windows,multithreading,winapi,visual-c++,pipe,Windows,Multithreading,Winapi,Visual C++,Pipe,使用1MB管道: if (0 == CreatePipe(&hRead,&hWrite,0,1024*1024)) { printf("CreatePipe failed\n"); return success; } 一次发送4000字节(bytesReq=4000) 4个字节在管道另一端的另一个线程中读取。在读取4个字节之前,您可以使用读取可用字节。不确定这是否告诉我管道的当前容量:“如果缓冲区大小为零,则根据需要分配缓冲区” while ((bytesReq = (F
if (0 == CreatePipe(&hRead,&hWrite,0,1024*1024))
{
printf("CreatePipe failed\n");
return success;
}
一次发送4000字节(bytesReq=4000)
4个字节在管道另一端的另一个线程中读取。在读取4个字节之前,您可以使用读取可用字节。不确定这是否告诉我管道的当前容量:“如果缓冲区大小为零,则根据需要分配缓冲区”
while ((bytesReq = (FileSize - offset)) != 0)
{
//Send data to Decoder.cpp thread, converting to human readable CSV
if ( (0 == WriteFile(hWrite,
readBuff,
bytesReq,
&bytesWritten,
0) ) ||
(bytesWritten != bytesReq) )
{
printf("WriteFile failed error = %d\n",GetLastError());
break;
}
// Would like to update a status box with the amount of data in the pipe.
I would like to know if and how often it is getting full....
}