Buradasın
C++ Main Function and Command-Line Arguments
learn.microsoft.com/en-us/cpp/cpp/main-function-command-line-args?view=msvc-170Yapay zekadan makale özeti
- Basic Requirements
- All C++ programs must have a main function
- Static members are initialized before main function
- Main function can't be overloaded, declared inline, or static
- Command-Line Arguments
- argc contains number of arguments, always greater than or equal to 1
- argv is array of null-terminated strings representing command-line arguments
- argv[0] is program name by convention
- argv[1] is first command-line argument
- Microsoft Extensions
- wmain function provides Unicode-compatible version of main
- _tmain macro enables separate narrow and wide character sets
- Main and wmain can return void for symmetry
- envp parameter allows access to user environment variables
- Argument Parsing
- Arguments delimited by white space (space or tab)
- Double quotes allow special treatment of first argument
- Wildcards (?) and * can be used for filename and path arguments
- Environment processing can be suppressed using noarg.obj or noenv.obj