![]() |
| | #1 |
| Registered User Join Date: Sep 2008
Posts: 2
| Need help with programming lab. I am working on a programming 2 lab and am unsure how to code the input and output for this assignment. Here is what the lab sheet says: "Your program will be expected to read input from the first file specified on the command line and to write output to the second file specified on the command line. Your program should display an error message and exit immediately if the expected command-line parameters are not provided. Following is an example of how your program will be run from the command line: $ ./main input.txt output.txt Your program will continue reading and processing commands from the input file until the end of the file is reached. After processing each command, your program should write the result to the output file. All input and output should use C++ streams (>> and <<). For this lab, strings may be stored in static-sized character arrays. You can assume that your program will not be tested with any strings longer than 100 characters, and all strings will be separated by whitespace. " With this criteria i am unsure on how to write my main function. Any help would be appreciated. |
| woody292 is offline | |
| | #2 |
| Registered User Join Date: Jan 2008
Posts: 66
| Use command line arguments in your main function like this. int main(int argc, char *argv[]) Then check of there is a parameter specified. |
| ThLstN is offline | |
| | #3 |
| Registered User Join Date: Dec 2006
Posts: 1,780
| |
| cyberfish is offline | |
| | #4 | |
| Registered User Join Date: Sep 2008
Posts: 2
| Quote: | |
| woody292 is offline | |
![]() |
| Tags |
| input, output |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Lab exam | hawkins786 | C Programming | 11 | 05-24-2005 11:24 AM |
| Datastructure lab | El_Maco | C++ Programming | 14 | 10-10-2004 07:35 AM |
| programming from home to the lab??? | nbo10 | Tech Board | 7 | 08-27-2004 04:35 PM |
| Please help debug this lab! Please! | mack_ol | C Programming | 0 | 02-17-2002 12:32 PM |
| stupid computer lab lady... | dirkduck | A Brief History of Cprogramming.com | 7 | 10-16-2001 06:53 PM |