command line parameter


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: command line parameter

  1. #1
    ludo Guest

    command line parameter


    hi,
    I am a beginer with MFC and I use VC to develop an application. I need to
    know how I can read and store command line parameters to display them later
    in a popup window.

    Thanks if you can help me

    ludo


  2. #2
    Christopher Thomas McGinlay Guest

    Re: command line parameter

    Access command line arguments like this:

    int main(int argc, char* argv[])
    {
    //argc is the number of args
    //argv is an array of arguments
    return 0;
    }

    Note that the first argument is always the name of the program.

    Chris

    ludo wrote:

    > hi,
    > I am a beginer with MFC and I use VC to develop an application. I need to
    > know how I can read and store command line parameters to display them later
    > in a popup window.
    >
    > Thanks if you can help me
    >
    > ludo



    --
    Ascent Software Limited Registered in Scotland: SC201671
    www.ascent.zetnet.co.uk Bank Of Scotland Buildings
    Lerwick, Shetland, ZE1 0EB


  3. #3
    LPVOID Guest

    Re: command line parameter


    Is your app a console based !?
    if so this is a little "parser" for arguments given in prompt.

    http://www.geocities.com/alessandro_.../TraceArgs.zip

    regards

    LPVOID


    "ludo" <ldumaine@corys.fr> wrote:
    >
    >hi,
    >I am a beginer with MFC and I use VC to develop an application. I need to
    >know how I can read and store command line parameters to display them later
    >in a popup window.
    >
    >Thanks if you can help me
    >
    >ludo
    >



  4. #4
    ralph Guest

    Re: command line parameter


    "ludo" <ldumaine@corys.fr> wrote:
    >
    >hi,
    >I am a beginer with MFC and I use VC to develop an application. I need to
    >know how I can read and store command line parameters to display them later
    >in a popup window.
    >
    >Thanks if you can help me
    >
    >ludo
    >


    Using MFC lookup CCommandLineInfo. MFC normally parses out the command line
    for its own purposes (CWinApp::ParseCommandLine). Some items on the command
    line are saved for you automatically - m_strFileName, for example. Others
    you can parse out for yourself.

    However, it you want to grab the command line and skip all the rigamarole
    use the "__argc" and "__argv" macros defined in <cstdlib>/<stdlib.h>. These
    macros evaluate to pointers and can be manipulated just like the parameters
    of "int main(int argc, char* argv[])".




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center