You are violating 7.21.5.3 The fopen function, paragraph 7 of the C standard:
When a file is opened with update mode ('+' as the second or third
character in the above list of mode argument values), both input and
output may be performed on the associated stream. However, output
shall not be directly followed by input without an intervening call to
the fflush function or to a file positioning function (fseek, fsetpos,
or rewind), and input shall not be directly followed by output without
an intervening call to a file positioning function, unless the input
operation encounters end- of-file.
This likely explains why the while (!feof(fPointer))
loop does not terminate. As incorrect as your usage is there, it does normally terminate. By ignoring the return value from fgets()
(among all the other return values ignored) you are likely missing an error being returned.
Since you have not provided any details regarding your implementation, it's impossible for an outside observer to know for sure.