1

I need to learn how to create a pipe and use fork, and also how to write to a pipe and read, in VC++ 2010.

Are there any tutorials on how to do that?

cha0site
  • 10,517
  • 3
  • 33
  • 51
Bawss
  • 38
  • 1
  • 8
  • 3
    Correct me if I'm wrong but... pipe and fork are Posix system calls, while VC++ is a Microsoft Windows IDE and framework... Why would you specifically ask for instructions for this one? – immortal Jan 28 '12 at 22:51
  • So you telling me I can't create pipe and use fork in vc++ 2010 Win32? D: – Bawss Jan 28 '12 at 22:53
  • What you're asking here is how to make orange juice from apples. It won't work. – cha0site Jan 28 '12 at 22:54
  • In theory you can create a posix executable and run it under SFU/SUA... – Neil Jan 29 '12 at 19:03

1 Answers1

2

This question is already answered in detail here. Quoting verbatim from the same answer

A pipe is a mechanism for interprocess communication. Data written to the pipe by one process can be read by another process. The primitive for creating a pipe is the pipe function. This creates both the reading and writing ends of the pipe. It is not very useful for a single process to use a pipe to talk to itself. In typical use, a process creates a pipe just before it forks one or more child processes. The pipe is then used for communication either between the parent or child processes, or between two sibling processes. A familiar example of this kind of communication can be seen in all operating system shells. When you type a command at the shell, it will spawn the executable represented by that command with a call to fork. A pipe is opened to the new child process and its output is read and printed by the shell. This page has a full example of the fork and pipe functions...

Community
  • 1
  • 1
IUnknown
  • 888
  • 7
  • 18