__argc, __argv, __wargv
__argc global variable is a count of the number of command-line arguments passed to the program.
__argv is a pointer to an array of single-byte-character or multi-byte-character strings that contain the program arguments, and
__wargv is a pointer to an array of wide-character strings that contain the program arguments. These global variables provide the arguments to
extern int __argc; extern char ** __argv; extern wchar_t ** __wargv;
In a program that uses the
__argv are initialized at program startup by using the command line that's used to start the program. The command line is parsed into individual arguments, and wildcards are expanded. The count of arguments is assigned to
__argc and the argument strings are allocated on the heap, and a pointer to the array of arguments is assigned to
__argv. In a program compiled to use wide characters and a
wmain function, the arguments are parsed and wildcards are expanded as wide-character strings, and a pointer to the array of argument strings is assigned to
For portable code, we recommend you use the arguments passed to
main to get the command-line arguments in your program.
Generic-text routine mappings
|Tchar.h routine||_UNICODE not defined||_UNICODE defined|
|Global variable||Required header|
||<stdlib.h>, <cstdlib> (C++)|
__wargv are Microsoft extensions. For compatibility information, see Compatibility.
Submit and view feedback for