main() command line arguments of console application

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I want to use command line arguments in a console application. Yet
regardless of what was entered on the command line, argc and argv
contain bogus values. Why?

Setup:

Platform Builder 5.0, target is a CEPC, and yes, the OS does include
the console component.

Embedded VC++ 4.0 with SP4.

Code:

int main (int argc, char *argv[])
{
printf("argc = %d (0x%0X), argv = %s\n",
argc, argc, argv ? argv[0] : "NULL");

getchar();

return 0;
}

Sample output:

argc = 981293930 (0x3A7D5B6A), argv = NULL

Issue: the command line arguments contain bogus values regardless of
what was entered on the command line. That is, regardless of _how
many_ (argc) values I entered, argc is always incorrect and argv is
always NULL.

.



Relevant Pages

  • Re: main() command line arguments of console application
    ... >I want to use command line arguments in a console application. ... > regardless of what was entered on the command line, ... > contain bogus values. ... > many_ (argc) values I entered, argc is always incorrect and argv is ...
    (microsoft.public.windowsce.embedded)
  • Re: C the complete nonsense
    ... "The argc parameter holds the number of arguments on the command line ... int main(int argc, char *argv) ... "The argv parameter is a pointer to an array of character pointers. ...
    (comp.lang.c)
  • Re: What does "*" mean in "int main(int argc, char *argv[])"?
    ... argv- is the array of parameters passed in the command line. ... it is a pointer to an array of type char. ... You can use argc in a for loop to process the argv[] values. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: cpmmand line arguments
    ... You cannot compile or run command line arguments. ... Obviously argc and argv can be any legal identifier but these two names ... The general method is to first test argc. ...
    (comp.lang.c)
  • [PS] Ignoring host formatting
    ... If I want to get all the information from a command in a nice format ... regardless of the number of columns available, ... cmdlet/pipeline into single rows? ...
    (microsoft.public.windows.server.scripting)