I have written a program that successfully reads certain lines from a file, and then does something with the this data. But, I want to use pipes in linux to accomplish the same task. In order words:
cat file | ./myProgram
I have tried to google this, but I didn't find anything useful. Thanks in advance!
From the above example I'm guessing you want the information from file to pipe to the created myProgram not even sure if that is possible. ...."THINKING" a pipe takes output from the previous to the next so..
why not create your program to use the file you input as an argument and work on piping it in the app using scripting. you not limited but be careful.
#include <iostream>
#include <vector>
int main()
{
std::vector<char> someData(10, '-'); // roughly same as char someData[10] = "---------";
std::cin.read(&someData.front(), someData.size());
someData.back() = '\0'; // NIL-terminated, so that it's known where it ends
std::cout << someData.data() << std::endl;
}