76 289
Assignments Done
Successfully Done
In May 2019

Answer to Question #552 in C++ for Peter

Question #552
How can I identify command line parameters my program was started with?
Expert's answer
To do this, you should check the variables argc and argv which contain respectively the number and the values of the parameters: int main(int argc, char* argv[]){}. Argument with index 0 is the name of the running program. The following values are the parameters of the program starting. For example:

./programm safe quick
argc = 3
argv[0] = /home/user/programm
argv[1] = safe
argv[2] = quick

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions