I'm trying to write a program that allows me to type something like this on the command line:
cat inputfile | myprogram outputfile
In myprogram I need to open both the input and output file without the input file being a parameter. I know how to open the output file and set it to a descriptor:
int out=open(argv[1],O_RDONLY);
But I don't know how to do this with the input file. I know the output of cat is sent to the cin of my program but I don't want to read the file in line by line. Is it possible to do this in a way similar to opening the output file? Like so:
int in=open(?????,O_RDONLY);