Parameter problems in C++ applications

This is a discussion on Parameter problems in C++ applications within the C++ Programming forums, part of the General Programming Boards category; Hi, I created a C++ application called Sujan.exe. In its main method it requires a char array of size 8. ...

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    1

    Parameter problems in C++ applications

    Hi, I created a C++ application called Sujan.exe. In its main method it requires a char array of size 8. here is a copy of my main:
    Code:
    int main(char s[9])//leave space for last character
    {
        cout<<s;
        //I'm not doing anything here, I just want to know
        //whether my program reads in the parameters
    
           return EXIT_SUCCESS;
    }
    Sujan.exe is in the C drive
    In command prompt I try to pass my parameters in various ways, all of which bring up access violations.
    C:/Sujan.exe/"~+02~-03"
    C:/Sujan.exe/~+02~-03
    C:/Sujan.exe "~+02~-03"
    C:/Sujan.exe ~+02~-03

    wats my problem? Am I asking the wrong thing in my C++ program or is my command to the exe flawed so that I cannot access these parameters?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,973
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    14
    Code:
    int main(int argc, char **argv)
    would help, where argv is an array of character arrays containing your arguments.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. my error is storage class specified for parameter
    By meli in forum C Programming
    Replies: 5
    Last Post: 03-27-2009, 12:06 PM
  3. Visual Studio Express 2008 problems.
    By Normac in forum C++ Programming
    Replies: 2
    Last Post: 08-08-2007, 10:41 AM
  4. A question about windows programming
    By Hussain Hani in forum Windows Programming
    Replies: 16
    Last Post: 05-23-2007, 07:38 AM
  5. C Pointers Problems
    By mhelal in forum C Programming
    Replies: 8
    Last Post: 01-10-2007, 05:35 AM

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