Solved

ReadFile freezing

Posted on 1998-02-04
1
463 Views
Last Modified: 2013-12-03
I have a pipe which i'm reading from with ReadFile()...everything is fine as long as there is data in the pipe, but if the writing function never puts data in the pipe, ReadFile() never returns and leaves the program hanging.  How can I stop ReadfFile from doing this or test to see if there is data in the pipe

P.S. I'm using VC++ 5 under win95
0
Comment
Question by:openGL
1 Comment
 
LVL 1

Accepted Solution

by:
yl earned 200 total points
ID: 1410880
You can use the PeekNamedPipe function to determine if there is data to be read from the pipe.
Alternately you can use overlapped i/o by using the FILE_FLAG_OVERLAPPED in the pipe creation in CreateNamedPipe. In that case the ReadFile operation will perform asynchronously and will return immediately if there is nothing to read.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question