You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cpp/main-function-and-command-line-args.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,8 +40,6 @@ If no return value is specified, the compiler supplies a return value of zero. A
40
40
41
41
**END Microsoft Specific**
42
42
43
-
The types for `argc` and `argv` are defined by the language. The names `argc`, `argv`, and `envp` are traditional, but are not required by the compiler. For more information and an example, see [Argument Definitions](../cpp/argument-definitions.md).
44
-
45
43
## Command line arguments
46
44
47
45
The arguments in the prototype
@@ -51,7 +49,7 @@ int main( int argc, char* argv[], char* envp[]);
51
49
int wmain( int argc, wchar_t* argv[], wchar_t* envp[]);
52
50
```
53
51
54
-
allow convenient command-line parsing of arguments and, optionally, access to environment variables. The argument definitions are as follows:
52
+
allow convenient command-line parsing of arguments and, optionally, access to environment variables. The types for `argc` and `argv` are defined by the language. The names `argc`, `argv`, and `envp` are traditional, but you can name them whatever you like. The argument definitions are as follows:
55
53
56
54
*argc*<br/>
57
55
An integer that contains the count of arguments that follow in *argv*. The *argc* parameter is always greater than or equal to 1.
@@ -62,7 +60,7 @@ An array of null-terminated strings representing command-line arguments entered
62
60
The first command-line argument is always `argv[1]` and the last one is `argv[argc - 1]`.
63
61
64
62
> [!NOTE]
65
-
> By convention, `argv[0]` is the command with which the program is invoked. However, it is possible to spawn a process using [CreateProcess](/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamew) and if you use both the first and second arguments (*lpApplicationName* and *lpCommandLine*), `argv[0]` may not be the executable name; use [GetModuleFileName](/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamew) to retrieve the executable name, and its fully-qualified path.
63
+
> By convention, `argv[0]` is the command with which the program is invoked. However, it is possible to spawn a process using [CreateProcess](/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamew) and if you use both the first and second arguments (*lpApplicationName* and *lpCommandLine*), `argv[0]` may not be the executable name; use [GetModuleFileName](/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamew) to retrieve the executable name, and its fully-qualified path.
0 commit comments