CLion - command line program arguments

吃可爱长大的小学妹 提交于 2019-12-23 07:46:39

问题


Can anyone tell me what wrong with JetBrains CLion, when I assign to Run/Debug Configurations - Program arguments something like "aaa bbb" and then print it:

printf("%s\n", argv[1]);

I just got "aaa", when it must be "aaa bbb" because they are in double quotes.

picture - this is what i get

Edit: tested in other IDEs (Dev C++, Codelite) and it works. Only Clion does not :( Just simple thing and can not figure it out...


回答1:


This appears to be a bug in CLion. For me, it only happens when I start the application without debugging it (Run > Run 'Test'). When I start in debug mode (Run > Debug 'Test'), it works fine and displays the whole string.

I've created an issue with JetBrains. I'll update this answer as soon as I hear back from them.




回答2:


Don't use Quotation marks("") and also make sure to delete any preceding spaces in Program argument text field in Run/Debug Configurations Windows, check the following screenshot.

image courtesy: uta
screenshot



来源:https://stackoverflow.com/questions/33599067/clion-command-line-program-arguments

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!