Problem faced in reading individual character in FORGETPW

I need a generic piece of advise. While coding FORGETPW, it’s troubling me to read individual character at the end of a line using scanf("%c"). scanf() is leaving ‘\n’ unconsumed. To eat it up, I am using a dummy scanf(). Don’t know the approach is elegant or not.But, for files created on Windows and Linux, it won’t work transparently because of different line-ending characters. The code is not portable.

Shall I assume the automated test being done on an input file created in Linux? Is there a better way to handle this situation?

You should be using getchar() instead to avoid the problem with ‘\n’.

instead of using scanf("%c",&inp);//this will read special char ,enter etc as well…
use scanf(" %c",&inp); //space before %c tell the statement ,not to read special char…

Isn’t getchar() buffered?

Maybe gets() work in C? Even though its deprecated, I believe it should work.
If you are in C++, you can simply use cin/cout with strings and you can get AC…

After reading with gets(), additionally I need to parse for characters.