Results 1 to 4 of 4

Thread: Command line?

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Command line?

    Managed C++...

    How do you get the command line string passed into the app?

    Its for a console program.

    Code:
    int main(?????)
    {
    Console::WriteLine("This is the command line: {0}", ?????);
    Console::ReadLine();
    return 0;
    }
    I don't live here any more.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    In C you add the following two arguments to main:

    int main (int argc, char * argv[])

    The first argument is the number of command line arguments passed and the second is an array of pointers to char which point to each command line string.

    I'm not sure if it is different in C++, but worth are try.

  3. #3
    Hyperactive Member sw_is_great's Avatar
    Join Date
    Nov 2003
    Posts
    330
    by argc and argv
    Regards

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Same in C++, but Managed C++ might use a managed String array.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width