O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying Help

The final topic that falls under the general heading of command-line processing is what to do when the users run the program but supply nothing. The answer is that you must display some kind of usage instructions. Those from the UNIX world will recall that almost every command that is typed on the command line needs parameters, and often typing it without any parameters will cause the standard usage information to be displayed.

You can also add a level of user choice by including a help flag:

/h     -h     -?

In addition, you might be able to offer the users help on a specific option:

My_Program -h File

This code is probably robust enough to let the programmers test for all of these. After all, if it returns false, no help is required; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required