Dos

Asked • 06/17/19

C++: How to use command line arguments?

I know that to use command line arguments, I have to do this.`int main(int argc, char* argv[])`Now most of the documentation i read about taking in command line arguments explain the situation, something like this:> Command-line arguments are given after the name of a program in> command-line operating systems like DOS or Linux, and are passed in to> the program from the operating system.So the only way i know to open my program, is to open it normally like i would do, either start debugging or open the exe fileNow here it seems that, to use command line arguments the program has to be opened differently, Using the Command-Line (DOS/Command Prompt for example), and then write the arguments after it.So my question isHow do i open my program using the Command-Line, and how do i enter the arguments after the program name?

1 Expert Answer

By:

Patrick B. answered • 06/17/19

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.