I was just wondering what the best way to deal with command line arguments is? Should I just use some different function, should I embed all the checking into main(), should I create a class that deals with them or is there another option I haven't thought of? I know this is a stupid question but I just couldn't figure out the best way to deal with them.

Thanx any and all help

8 Years
Discussion Span
Last Post by liveonfire

It depends on the size and complexity of program you're trying to write. If it's a small program and the validation is short and simple, it would not be wrong to check the arguments in main( ). If the testing was more complex, you could pass the argc and argv to a function that will validate them, returning a true or false to main, where you then continue or not.


Ok, thanx! I just wasn't sure if I should use an object or something to do all the validating and what not. All the tutorials I found are very vague on the subject.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.