Link to home
Start Free TrialLog in
Avatar of BrianGEFF719
BrianGEFF719Flag for United States of America

asked on

ReadFile API

I am using readfile api to read from a pipe however if there is no data in the pipe, it will just hang until data arrives, is there a way to just check the pipe for data instead of reading to prevent the hanging.


Please look at:
http://oldlook.experts-exchange.com/questions/20934771/CreateProcess-Pipe-Problem.html



I will award points for both questions if I can get an answer.
Avatar of plq
plq
Flag of United Kingdom of Great Britain and Northern Ireland image

Use WaitForSingleObject but dont put INFINITE in that parameter, just wait a couple of milliseconds
Avatar of BrianGEFF719

ASKER

What does WaitForSingle object do?
ie

Public Type COMMTIMEOUTS
        ReadIntervalTimeout As Long
        ReadTotalTimeoutMultiplier As Long
        ReadTotalTimeoutConstant As Long
        WriteTotalTimeoutMultiplier As Long
        WriteTotalTimeoutConstant As Long
End Type
Public Declare Function SetCommTimeouts Lib "kernel32.dll" _
 (ByVal hFile As Long, lpCommTimeouts As COMMTIMEOUTS ) _
 As Long
ASKER CERTIFIED SOLUTION
Avatar of sokolovsky
sokolovsky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
its not a named pipe, its an anonymous pipe.


-Brian
sokolovsky!!! YOU ARE THE MAN! You saved my ass. Thank you so much