In order to process input using < & output using > in command line what does the code need to look like

I have looked in many places but have not seen the specific answer regarding the use of < > in a command line prompt and what the code would be to use the input file and then send the output to the name specified. I have to use the command line and I have arguments to pass which I coded just fine but I am truly confused on how the program reads in said file and outs new file. I have to use standard input/output which I get that I am supposed to have a getline to read in the data.
I'm thinking there should be something more than that. How do I call it in to use because surely I would not be limited in my input to just the file so what do I use in my code that says this is what I want you to read and then output to said file.

in other words command line like this

 
  programName argv1 argv2 < sometextfile.txt > somenewtextfile.txt


Does the name of the file become argv3 and then the output argv4 and I code it like I do my other arguments or is there a specific thing besides using getline and cout which have to be used mind you that I have to add to it. I have tried things and keep getting a cant find file specified (trust me it is there!) which is why I figure there is something specific besides I'm thinking with my little programming knowledge that it would need to be specified some more direct way than just cout or cin basically.
I can't get past it and its a critical factor to finish the rest of my program so any help would be so appreciated! Thanks in advance and if I'm just being a moron please feel free to tell me so!
As I understand it, the shell handles the piping so they are not command line arguments your program can see at all; you would access them using standard input/output files/streams.

So if you used getline() on cin inside programName, it would be reading from sometextfile.txt. And writing to cout would write to somenewtextfile.txt.
Topic archived. No new replies allowed.