Zuy BK
Zuy BK

Reputation: 105

CLion - command line program arguments

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

Upvotes: 8

Views: 30987

Answers (2)

M.Siri
M.Siri

Reputation: 111

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

Upvotes: 3

Daniel Wolf
Daniel Wolf

Reputation: 13643

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.

Upvotes: 3

Related Questions