argv = LPSTR string, argc = int cmdShow?

This is a discussion on argv = LPSTR string, argc = int cmdShow? within the Windows Programming forums, part of the Platform Specific Boards category; Hey guys. I was wondering if anyone new the equivalent to C's **argv and argc? I had a hunch it ...

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600

    argv = LPSTR string, argc = int cmdShow?

    Hey guys. I was wondering if anyone new the equivalent to C's **argv and argc? I had a hunch it was the last two parameters of the standard WinMain arguments, the LPSTR and int variable.

    But even if so, I cannot manipulate them as such. For instance, with C's **argv variable, I can do:

    puts(argv[0]);

    But

    TextOut(hdc, x, y, myLpstr[0], len);

    crashes my system!

    So either I got the wrong variables, or else I just am wrong that a LPSTR is just a typedef for a char **...

    Any idea?

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    2
    You can use the function GetCommandLine() to retrieve the entire string in that variable.

    I think it is just a single char * and not a **.

    -Mezz

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    Cool, thanks. So I'm assumming all of the args have simply been pasted onto a single string?

    Cheers...
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  4. #4
    Registered User
    Join Date
    Feb 2002
    Posts
    2
    Yes I'm guessing so, I've never actually bothered much with the cmd line yet in Win32 apps.

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    Hmmm, actually, GetCommandLine() returned a NULL! And that was even after I dropped like ten files into the program to open it!
    Nothing worked. Is it simply not one of the parameters of WinMain? Surely the last two, the LPSTR and int? Then again that int,( usually "cmdShow" or "nFunsterstil", I called mine simply argc!!) returned wacky results too, sometimes printing out 0, 5, 1, etc, not even the number it should've counted...
    ...sigh...I hate Windows!!!

  6. #6
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,600
    Got it! Thanks...
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can some one please tell me the cause of the error ?
    By broli86 in forum C Programming
    Replies: 8
    Last Post: 06-26-2008, 08:36 PM
  2. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 11:05 PM
  3. Replies: 1
    Last Post: 10-27-2006, 01:21 PM
  4. easy if you know how to use functions...
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 01-31-2002, 06:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21