Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ReadFile hangs at end of Pipe

29 views
Skip to first unread message

James Jones

unread,
Apr 20, 2003, 1:44:04 PM4/20/03
to
Hi all,

I'm trying to Read the results from a perl.exe into my
app using createpipe, CreateProcess and then looping
through ReadFile until no more chars are left in the
stdIn Pipe.

Data is being returned fine, however on the final
ReadFile when it should return 0 for bytesread, It just
HANGS as if its waiting for more data.

Any ideas on how I can solve this problem will be most
welcomed,

Regards
James Jones
Ja...@Starlots.com

Tom Esh

unread,
Apr 20, 2003, 3:56:28 PM4/20/03
to
On Sun, 20 Apr 2003 10:44:04 -0700, "James Jones" <Ja...@Starlots.com>
wrote:

>I'm trying to Read the results from a perl.exe into my
>app using createpipe, CreateProcess and then looping
>through ReadFile until no more chars are left in the
>stdIn Pipe.
>
>Data is being returned fine, however on the final
>ReadFile when it should return 0 for bytesread, It just
>HANGS as if its waiting for more data.
>
>Any ideas on how I can solve this problem will be most
>welcomed,

It's not exactly the same thing, but I solved a problem with ReadFile
hanging when there's no data to begin with by using PeekNamedPipe
(which also works with anon pipes) to determine if anything remained
to be read before calling ReadFile. Offhand seems like it should work
in your case too.


-Tom
MVP - Visual Basic
(please post replies to the newsgroup)

0 new messages