When you pipe to another program it goes to the standard input and not to the arguments in main.
This piece of code prints out what it receives on stdin
to stdout
, try this:
for (std::string line; std::getline(std::cin, line);) {
std::cout << line << std::endl;
}