I have used pipes in C/C++ before but I'm working on setting up a pipe in some legacy Ada code...however I am still in the "learning" phase with Ada and there's a lot I still don't yet know.
That being said, I've been trying to figure out how pipes in Ada are setup & how to go about using them. I've only found these articles thus far:
Don't get me wrong they have a lot of good knowledge in them, but 1 is geared towards Ada95 (I have the ability to compile up to Ada05), 2 just lists the functions, & 3 offers little in the way of explanation.
Does anyone know of a tutorial for Ada pipes? Or better yet, could someone give a quick example of how to implement a simple pipe in Ada?
I realize that this is not the most ideal question to ask, but I'm running out of "Google Combinations"...
You might be more interested in Streams -- http://en.wikibooks.org/wiki/Ada_Programming/Input_Output/Stream_Tutorial
Especially since, if you make a package that binds a stream to a pipe you get free access with Type_Name'Read( stream, object ) & Type_Name'Write( stream, object ).
This may be overengineering a little, but there is gnat.sockets if you are allowed to use gnat libraries.
After all a pipe is a simpler version of a socket (or a socket being an expanded version of a pipe), both allow you to transfer data between tasks/processes.
If you want to use Unix pipes in an Ada application, you should consider the POSIX Ada API, as it is a formal standard. One implementation of this is the "FLORIST" library.
The Crimeville language server is an example of how you can use pipes to handle communication between an Ada application and a legacy application with a pipe-friendly interface.
Code
Compiled on Windows 10 with GNAT GPL 2015
Output
The output will differ from user to user .
Ada the language has nothing to say on the subject of pipes; they don't form part of the standard library. I suspect the same is true of C++ and the Boost library (not that I'm a user); pipes are an operating system facility.
Your article 1 contains source which compiles and works with Ada 2005 and Ada 2012 as well as (I expect) Ada 95 - at any rate on Unix systems. Won't that do?
Your article 2 - rather, the
Util
package found by poking around a bit - says it works on Windows and Unix.The software available at your article 3 has the great advantage of being maintained!
As for a tutorial - since pipes aren't in the standard you have to use what the people who wrote the particular library you choose have provided. Articles 1 and 3 both contain demonstration programs (I haven't checked article 2). I suspect that's it!