Pelles C forum

C language => Beginner questions => Topic started by: tpekar on May 15, 2014, 10:46:33 PM

Title: Using a pipe
Post by: tpekar on May 15, 2014, 10:46:33 PM
Does anyone have a simple example of using a pipe to communicate between a parent and child process?  Thanks!
Title: Re: Using a pipe
Post by: jj2007 on May 15, 2014, 11:48:40 PM
In assembler, yes:

include \masm32\MasmBasic\MasmBasic.inc      ; download (http://masm32.com/board/index.php?topic=94.0)
  Init
  Inkey "Current time is ", Launch$("cmd.exe /C time /T")
  Exit
end start


Seriously: Pipes are a can of worms. For example, to avoid hanging apps, you need to read data in separate threads etc...

To get an idea (and some really good hits), google for SECURITY_ATTRIBUTES HANDLE_FLAG_INHERIT CreatePipe SetHandleInformation CreateProcess WaitForInputIdle CreateThread (https://www.google.com/search?q=SECURITY_ATTRIBUTES+HANDLE_FLAG_INHERIT+CreatePipe+SetHandleInformation+CreateProcess+WaitForInputIdle+CreateThread)
Title: Re: Using a pipe
Post by: frankie on May 16, 2014, 09:00:08 AM
Could be a starting point...
Title: Re: Using a pipe
Post by: frankie on May 16, 2014, 02:13:58 PM
These are the standard native applications (from here (http://msdn.microsoft.com/en-us/library/windows/desktop/aa365780(v=vs.85).aspx)).