Command-line switch

How do I give C++ Builder a "Command-line switch" command? i.e. Command-line switch = -P.

Dwight

Comments

  • : How do I give C++ Builder a "Command-line switch" command? i.e. Command-line switch = -P.

    You can create a Console applications, then you get a traditional main function.

    But I think you want to access these from a VCL (or CLX) Application. Then I believe this is not possible. If you look at 'Project1.cpp' you see the WinMain function:
    [code]
    WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
    [/code]

    I do not know how to extract command line arguments from it.

    There are plenty of alternatives for defining conditionals. You could add defines to 'Project | Options | Directories/Conditionals | Conditional Defines'. This is pretty common (you already see _NDEBUG there).

    Hope to have helped you,

    bilderbikkel

  • : : How do I give C++ Builder a "Command-line switch" command? i.e. Command-line switch = -P.
    :
    : You can create a Console applications, then you get a traditional main function.
    :
    : But I think you want to access these from a VCL (or CLX) Application. Then I believe this is not possible. If you look at 'Project1.cpp' you see the WinMain function:
    : [code]
    : WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
    : [/code]
    :
    : I do not know how to extract command line arguments from it.
    :
    : There are plenty of alternatives for defining conditionals. You could add defines to 'Project | Options | Directories/Conditionals | Conditional Defines'. This is pretty common (you already see _NDEBUG there).
    :
    : Hope to have helped you,
    :
    : bilderbikkel
    :
    :
    I was looking for a way to add C routines to a project and have C++ Builder compile them. I found that by putting "-P" in the "Run Parameters" dialog found under "Run", all works fine.

    Thanks, Dwight
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories