There is wrong somewhere else because the no of characters cannot change between fprintf and printf.