Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running c program at command line prompt

Status
Not open for further replies.

gunalan

Technical User
Jun 29, 2004
52
US
hi,

i am trying a run a program at command line prompt..i wanted to give values at command prompt...how to do it thru visual c++

thanx..
 
It really depends on what you are trying to do

If you want to run the program using one small set of values you could pass them in as arguments at the command line

If you want to process an indefinite number of values, you could investigate cin and cout - ie get the program to prompt and wait for you to enter them

If you want to process large numbers of values, you could read them in from a file








Go not to cats for advice for they will just walk over the keyboard
 
Code:
    system("program_name.exe argument1 argument2");

to use these inside a program,

Code:
    int main(int argc, char *argv[])
    {
      int i;
      for(i=0;i<argc;i++)
      {
        printf("%s\r\n", argv[i]);
      }
    }

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top