Problem: Write the program columns that takes three command-line arguments. The first is the file to open, the second, the file to write to, and the third is the number of characters to display on each line. Read the input file, character by character, echoing to the output file, inserting a line break after the line width is reached. If the correct number of parameters are not passed, print an error message and exit. You'll have to convert the third parameter to an int for your processing.
This is one of the problem my professor provided for us to study for an exam. I am completely don't know how to handle this problem. And I could not find any example with could help me.
Can someone please help me with this problem? I really need to know this for an exam on Monday. Please.
Thanks.
Test code(my professor provided, I have no idea how this could test the program.)
system("columns file11.txt file12.txt 25");
cout << "After running:" << endl;
system("cmd /c type file12.txt")
file11.txt:
The pale Usher--threadbare in coat, heart, body, and brain; I see him now. He was ever dusting his old lexicons and grammars, with a queer handkerchief, mockingly embellished with all the gay flags of all the known nations of the world. He loved to dust his old grammars; it somehow mildly reminded him of his mortality.
"While you take in hand to school others, and to teach them by what name a whale-fish is to be called in our tongue leaving out, through ignorance, the letter H, which almost alone maketh the signification of the word, you deliver that which is not true." --HACKLUYT