You are here:

C++/C++-command line arguments

Advertisement


Question
how do i work with command line arguments in C++(how to pass the arguments)

Answer
Hi Nazneen

compile the program and as you have compiled the program the exe has been generated in the same folder where you have you .c file next isstart command promt(DOS) go to that folder where the exe has been generated next call the exe with some arguments like this

C:\TC\BIN> filename "arg1" arg2" etc
where "C:\TC\BIN" this is the path where your exe is generated, filename is the name of the exe generated if your program name is nazneen.c then the exe will be generated as nazneen.exe and ar1 and arg2 is the argument you are passing to the program.

In case of any doubt please don't hesitate to get back to me.

regards
Joydeep Bhattacharya
http://www.scodz.com

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Joydeep Bhattacharya

Expertise

TSR, Socket and Very Complex Mathematical Problem

Experience

Worked on many OOP projects with design patterns

Organizations
http://www.scodz.com

Publications
http://www.scodz.com

Education/Credentials
Master of Computer Applications

Awards and Honors
Being a proud owner of a website of programming called http://www.scodz.com

Past/Present Clients
http://www.funforu.com http://www.dhoondho.com http://analysingc.50webs.com

©2016 About.com. All rights reserved.