问题
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