_argv, _wargv
Go Up to stdlib.h Index
Header File
stdlib.h
Syntax
extern char **_argv;
extern wchar_t ** _wargv;
Description
_argv points to an array containing the original command-line arguments (the elements of argv[]) passed to main when the program starts.
_wargv is the Unicode version of _argv.
Example
#include <iostream>
#include <stdlib.h> // TO GET THE GLOBAL _arg VALUES
using namespace std;
void func()
{
cout << "argc= " << _argc << endl;
for (int i = 0; i < _argc; ++i)
cout << _argv[i] << endl;
}
void main(int argc, char ** argv)
{
func(); // func can get the program arguments from global variables.
}
Portability
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
_argv |
+ |
|||
_wargv |
NT only |