Recreating the echo program

In this hands-on example, we will be recreating the popular echo program found on almost all POSIX systems. The echo program takes all of the input provided to the program and echoes it back to stdout. This program is very simple, with the following program options:

  • -n: Prevents echo from outputting a newline on exit
  • --help: Prints the Help menu
  • --version: Prints some version information

There are two other options, -e and -E; we have omitted them here to keep things simple, but, if desired, would serve as a unique exercise for the reader.

To see the full sources for this example, please see the following: https://github.com/PacktPublishing/Hands-On-System-Programming-with-CPP/blob/master/Chapter06/example1.cpp ...

Get Hands-On System Programming with C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.