eldruin / ipc-fdstream Goto Github PK
View Code? Open in Web Editor NEWInter-Process Communication with C++ STL-Like streams through file descriptors
Home Page: https://blog.eldruin.com/inter-process-communication-pipe-fork-cpp-stl-like-streams/
Inter-Process Communication with C++ STL-Like streams through file descriptors
Home Page: https://blog.eldruin.com/inter-process-communication-pipe-fork-cpp-stl-like-streams/
This is a basic example of inter-process communication using fork() and pipe() in C++ Includes an example of creating a C++ stream from a file descriptor and how to read/write from/to it using << and >> operators Needs GCC's libstdc++ and a POSIX environment Usage: $ make $ ./parent Output: Parent: I'll send the child a message. Parent: Child just said through stdout: "Program: I've received: 'Hello Child!'" Parent: Child just said through stderr: "Program: This is the error stream!" The scenario is: A parent process wants to handle another program’s input and output streams, a process-level wrapper. So the example is: A parent process forks into another child process. The parent sends the child a message, the child receives it and outputs it to the parent to show the communication works just fine. The forked process calls the program we want to control. Which in this case is the easiest C++ program ever: Just reads a line from the standard input and outputs a message containing the line just read through the standard output. In addition, another message is sent through the standard error stream. Further explanation: https://blog.eldruin.com/inter-process-communication-pipe-fork-cpp-stl-like-streams/ Resources: YoLinux Tutorial: Fork, Exec and Process control Beginning Linux programming, Matthew & Stones, Wrox Press The GNU C Library manual The GNU C++ Library manual fileno(3) on C++ Streams: A Hacker's Lament, Richard B. Kreckel Author: Diego Barrios Romero Public domain Copyleft 2011
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.