开发者

anyone know how to add command line args in vs2008

开发者 https://www.devze.com 2022-12-20 11:09 出处:网络
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 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?


Right click the project in Visual Studio. Click Properties. On the Debugging page, there is a Command Arguments property.


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


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).


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消