What does fscanf function return here?

You are saying is it because of do-while statement?

First do then check?

I tried with normal While.It still has that problem.