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

Recommended Answers

All 2 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.