views:

46

answers:

1

if i got a c++ executable file like this: executable.exe and i want to add some parameters like: executable.exe +username = pino

how do i get in c++ that i filled in pino as my username?

+4  A: 

Arguments to main. Your main is

int main(int argc, char **argv) {
    ...
}

All the command-line params are in argv. There are also Windows-specific APIs.

bmargulies
To clarify: argv is an array of char* pointers aka strings. `argc` indicates how many strings you have. By convention, argv[0] is a char* pointing to "executable.exe" - the name of your app - but this is not entirely reliable.
MSalters