Command line arguments and file redirection
Does any one know about any example of file redirection by using command line arguments such as:
int main (int argc, char *argv[])
{
..........
}
I wrote a program that reads from a file by using
the above structure but when I am running I run this way:
<progname> file.txt
file.txt is a file to be read from as an input to the program and my program outputs to the screen.
but what I have been asked in an assignment is like this when running on the console:
<program name> file1.txt > file2.txt.
if anyone has any example somewhere or how to implement please your help is needed
thanks in advance.
By abdi