在Eclipse中使用argc和argv? [英] Using argc and argv in Eclipse?
问题描述
int argc
和 char * argv []
参数到 main
。每当我尝试这样做,它给我的错误,它不能保存。有没有办法在Eclipse中使用 argc
和 argv
我想你的问题是,你不知道热传递参数给你的程序,当你通过eclipse执行它不是吗?
如果这是你想要的,请阅读以下内容。
点击项目 - >属性,然后在运行/调试设置点击新建按钮。选择C ++应用程序。在这里您可以看到有4个选项卡,第二个选项卡称为参数。
在此选项卡中,您可以看到一个textarea。在那里输入您的应用程序的参数,然后单击确定。
当您通过eclipse的播放按钮执行应用程序时,您的程序将被调用。
I have a working program but now I have to use the int argc
and char *argv[]
parameters to main
. Whenever I try to do this it gives me errors that it cannot save. Is there any way to make argc
and argv
work in Eclipse?
I guess your problem is that you don't know hot to pass argument to you program, when you execute it through eclipse isn't it ?
If that is what you want, read the following.
Click on the "Project->Properties" then in "Run/Debug settings" click on the "New button". Choose C++ application. Here you can see that there are 4 tabs, and the second tab is called "arguments". In this tab you can see a textarea. Type your application's argument there, and click "OK". When you will execute your application thanks to the "play" button of eclipse, your program will be called with arguments.
这篇关于在Eclipse中使用argc和argv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!