When I write C program code like this:
if ((input = fopen("input.txt", "r")) == NULL)
After use auto format ctrl+shift+F, the code turns into below, with "an extra space" after keyword NULL:
if ((input = fopen("input.txt", "r")) == NULL )
Would someone please help to figure out a solution? Thanks!
This issue is not related to Formatter -> Edit -> White space -> check "Before closing parenthesis". This extra space was added only after keyword NULL. Suppose I write:
if ((input = fopen("input.txt", "r")) == 0)
There will be no extra space added after 0, even if I use auto format ctrl+shift+F.
This can be adjuster in the formatter that you are using in Eclipse:
Go to Windows -> Preferences -> C/C++ -> Code Style -> Formatter.
Click on Edit.
Click on "White Space" tab.
Go to Control Statements -> 'if else'
Uncheck "Before closing parenthesis"
So if i right you want to modify the settings of the formatter of eclipse, so you just go to
Window > preferences
and in the left panel find the:
C/C++>>Code Style>>Formatter
Now you click to edit the profile.
Go to the tab White spaces and find the Control statement >> 'if else' , now only modify the checkBoxes and you can redefine that as you like.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.