PRB: Accessing Command-Line Parameters in a Windows Program

ID Number: Q78201

1.00

WINDOWS

docerr

Summary:

On page 256 of the "Microsoft C for Windows" manual that shipped with

Microsoft Quick C for Windows (QC/Win) version 1.0, the use of the

variables __argc and __argv is documented incorrectly.

The section titled "The Application Command-Line Parameter" states:

To extract filenames or options from the command line, you need to

parse the command line into individual values. Alternatively, you

can use the __argc and __argv variables.

To use the __argc and __argv variables, they must be declared as

"externs"; otherwise, a C2065 ("identifier undefined") error will

result. For example:

extern int __argc;

extern char * __argv[];

int PASCAL WinFunc ( ... ) {}

This is also incorrectly documented on page 14-3 in the "Microsoft

Windows Software Development Kit Guide to Programming" manual shipped

with the Windows 3.0 SDK, where argc and argv are declared as externs

with only a single underscore instead of two underscores.

Additional reference words: _argv _argc argv argc 1.00