Hello C experts,
I am searching for a tool which can validate content of printf (static string part) against an english dictionary , have anyone of you come across such tool , here is the example to clarify.

printf("The value of the interface identifier is %d",i);
printf("This intarface is not configured\n";

The idea is to catch such spelling mistake in printf statement in the C code.

Edited 6 Years Ago by ithelp: n/a

Seems to depend on which IDE you use. Visual Studio has some 3rd party tools available (see this article).

If you just have a text editor you can probably write a program to pare down your code to the strings (marked by a line number), import that into word, correct everything and make your changes by hand.

If you just have a text editor you can probably write a program to pare down your code to the strings (marked by a line number), import that into word, correct everything and make your changes by hand.

But the problem with that method is that it will even flag scanf, printf, struct etc as errors.
@ithelp
If you can painstakingly add the syntaxial words in to the in-built dictionary, i think you would be better off.
But mind you, turn of the grammatical error flagging system. Then there would be no end to pain

pare down your code to the strings

it will even flag scanf, printf, struct etc as errors.

That's why I was saying to pare it down (strip off the other stuff and just leave the strings). You could grab text from "(quote) to "(quote) and hang on to that so you'd end up with something like:

(Line #)
   17 -- The quick brown fox
   19 -- Enter a number: 
  201-- The net annual sales are

Spell check it, write it out as text from the WP, merge it in as you see fit.

I will grant you it's a tedious and roundabout way of doing things, so hopefully OP can find a 3rd party add in for the IDE or favorite text editor.

Or you could leave all the errors in there. It makes the final product sparkle.

Edited 6 Years Ago by jonsca: n/a

I believe the emacs spell checker is restricted to just comments and string constants when spell-checking code.

I'd never used it before, but apparently SlickEdit has a spell checker. It can be restricted to looking only at strings and comments.

This article has been dead for over six months. Start a new discussion instead.