Reputation: 671
i have a program that runs like so:
a.out 23421232
now if i use a.out it will tell me check params and gives an example and closes. I am curious if there is a way to add command line args when executing my code in vs2008?
Upvotes: 0
Views: 606
Reputation: 57764
Besides using the VS IDE to add parameters for running the program in the IDE, you can also open a command prompt window (Start | Run | cmd
) and run the program the same as in Linux, except the .exe extension is optional:
C:\Windows> cd "\Documents and Settings\Administrator\Applications\MyProject"
C:\Documents and Settings\Administrator\Applications\MyProject> myprogram 23421232
Upvotes: 2
Reputation: 490048
VS doesn't normally produce an executable named a.out
like most Unix compilers do. Instead, given an input XXX.cpp
, it'll produce an executable named XXX.exe
.
Adding command line arguments is done by bringing up the project properties (Alt+F7), selecting "Debugging" and then entering the argument(s) in the "Command Arguments" control. There, you'll add JUST the argument "23421232" (or whatever).
Upvotes: 1
Reputation: 564333
Go into the Project Properties window for your executable project.
Under the "Debug" section, you can specify your command line arguments. These will be used when debugging.
Upvotes: 1
Reputation: 354979
Right click the project in Visual Studio. Click Properties. On the Debugging page, there is a Command Arguments property.
Upvotes: 4