use of argc and argv

Discussion in 'C++' started by Claudio Varini, Oct 28, 2004.

  1. Hallo,
    is the use of argc and argv to pass input parameters "object oriented"?

    Or in C++ is better to use other approaches (es the command cin)?

    Thanks

    --
    Claudio Varini
    Büro: E5-113
    Tel. +49 521 106 6197
     
    Claudio Varini, Oct 28, 2004
    #1
    1. Advertising

  2. Claudio Varini wrote:
    > Hallo,
    > is the use of argc and argv to pass input parameters "object oriented"?


    There is AFAIK no other way to pass parameters to a program. What you
    can do is to wirte a OO CommandlineHander, which takes these parameters

    > Or in C++ is better to use other approaches (es the command cin)?


    This will not work, becaue, it can only read such params while the
    program is running, not when it starts.

    HTH && Kind regards,
    Nicolas
     
    Nicolas Pavlidis, Oct 28, 2004
    #2
    1. Advertising

  3. Claudio Varini

    Rolf Magnus Guest

    Claudio Varini wrote:

    > Hallo,
    > is the use of argc and argv to pass input parameters "object oriented"?


    What exactly do you mean by "obhect oriented"?

    > Or in C++ is better to use other approaches (es the command cin)?


    I don't know what you're talking about. What has cin to do with argc and
    argv?
     
    Rolf Magnus, Oct 28, 2004
    #3
  4. Claudio Varini

    Howard Guest

    "Claudio Varini" <-bielefeld.de> wrote in message
    news:-bielefeld.de...
    > Hallo,
    > is the use of argc and argv to pass input parameters "object oriented"?
    >
    > Or in C++ is better to use other approaches (es the command cin)?
    >


    Those command line parameters are simply a count of the number of parameters
    and an array of that many character arrays. You simply treat them as
    variables. They're not objects, and they also can't be "read" using cin.
    When main() executes, they're passed in as parameters to that function, just
    like parameters to any other function. What is it you are trying to do?
    (You should be able to find many examples of using those if you search the
    web. Try groups.google.com.)

    -Howard
     
    Howard, Oct 28, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. userfriendly

    argc and argv

    userfriendly, Feb 29, 2004, in forum: C++
    Replies:
    3
    Views:
    6,012
    Buster
    Mar 1, 2004
  2. Billy Patton

    How to alter argc and argv

    Billy Patton, May 31, 2005, in forum: C++
    Replies:
    5
    Views:
    861
    red floyd
    Jun 3, 2005
  3. Hal Styli
    Replies:
    14
    Views:
    1,657
    Old Wolf
    Jan 20, 2004
  4. ern
    Replies:
    2
    Views:
    431
    Walter Roberson
    Aug 17, 2006
  5. vicky

    about argc and argv

    vicky, Jun 27, 2007, in forum: C Programming
    Replies:
    11
    Views:
    599
    Richard Heathfield
    Jun 28, 2007
Loading...

Share This Page