Thread: argc

  1. #16
    ---
    Join Date
    May 2004
    Posts
    1,379
    main() should return a 0 or a 1 not 5150

  2. #17
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    Quote Originally Posted by Dave Evans
    I have never heard or read (before this) that in some cases the user-supplied arguments can begin with argv[0]
    This happens not with argv, but with lpCmdLine in the WinMain prototype, where lpCmdLine is the full string (spaces included) after the program name invocation:
    Code:
    int WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow);
    
    //command line
    mywin32prog.exe 1 2 3 4          me likes pie
    
    //will result in
    lpCmdLine =  "1 2 3 4          me likes pie"
    //or
    argv[0] = "mywin32prog.exe"
    argv[1] = "1"
    argv[2] = "2"
    argv[3] = "3"
    argv[4] = "4"
    argv[5] = "me"
    argv[6] = "likes"
    argv[7] = "pie"
    Last edited by xErath; 11-16-2004 at 05:40 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help getting a grib on argc and argv
    By elwad in forum C Programming
    Replies: 10
    Last Post: 05-01-2009, 10:13 AM
  2. Using argc and argv data
    By Rad_Turnip in forum C Programming
    Replies: 4
    Last Post: 03-31-2006, 06:09 AM
  3. Converting a argc / argv construct into a va_list
    By chambece in forum C Programming
    Replies: 6
    Last Post: 07-03-2005, 04:47 PM
  4. argc & argv
    By miryellis in forum C Programming
    Replies: 11
    Last Post: 09-19-2004, 11:59 PM
  5. Replies: 18
    Last Post: 06-21-2003, 10:57 AM