Re: asking about pipe line



I found the answer from msdn

The parent process uses the other ends of the pipes to write to the
child process's input and read the child process's output. The handles
to these ends of the pipe are also inheritable. However, the handle
must not be inherited. Before creating the child process, the parent
process must use DuplicateHandle to create a duplicate of the
application-defined hChildStdinWr global variable that cannot be
inherited. It then uses CloseHandle to close the inheritable handle.
For more information, see Pipes.

thanks to Joseph : )



On 11月30日, 下午2时59分, Joseph M. Newcomer <newco....@xxxxxxxxxxxx> wrote:
Note that you will probably have to send an end-of-file to stdin, typically Ctrl+Z.
Otherwise, it continues to wait for input. I'm not sure what would happen if you closed
the SendToChild handle...it may or may not react well to a broken pipe.

Until the child process has read all the input, it cannot produce the sorted output.
joe

On Thu, 29 Nov 2007 19:35:26 -0800 (PST), Baby Lion <BabyLion.Li...@xxxxxxxxx> wrote:
it just wait to read from the child process ,but not to move on
y ?
thanks

Joseph M. Newcomer [MVP]
email: newco...@xxxxxxxxxxxx
Web:http://www.flounder.com
MVP Tips:http://www.flounder.com/mvp_tips.htm

.



Relevant Pages

  • Re: yet another fork issue (I think)
    ... Lew Pitcher wrote: ... In the parent process, you printfthe copyright, and the "running image" ... But I've stubbed latex out in mathtextest.c and that child just runs ... The buffer will be flushed when either ...
    (comp.unix.programmer)
  • Re: Change redirection of stdout of child process
    ... >> I do not want to redirect stdout to a pipe which is handled by the ... >> The parent acts as debugger an gets regularly control over the child. ... >> Maybe it would be possible to inject a thread into the childs process ... > Your first course of action is to use pipes - you really should test this ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Basic Inter process communication question
    ... child process and the wait for the child process to complete. ... The twist is that I don¹t want the memory of the parent process to be ... so when the third party code crashes it does not bring everything down ...
    (comp.unix.programmer)
  • Re: Change redirection of stdout of child process
    ... >>> The parent acts as debugger an gets regularly control over the child. ... >> Your first course of action is to use pipes - you really should test this ... >> Your suggestion of injecting a thread into the child (which subsequently ... >> if(!ReadProcessMemory(hDestProc, pWriteAddr, &hOldHandle, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Invoking external processes in threaded program
    ... some pipes. ... the child other than exec*immediately. ... When you fork, only the thread that called forkis duplicated, so you ... is locked before the fork by a thread other than the forking thread, ...
    (comp.unix.programmer)

Loading