Line 33.
fprintf(ci,"Amount paid to date: %.2f\n",& info.apaid);
Your passing the address of info.apaid to fprintf.. It should be.
fprintf(ci,"Amount paid to date: %.2f\n", info.apaid);
Also your using fflush() incorrectly, you should never flush an input stream. If you want to flush all possible streams then call fflush(NULL).
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
But why didnt it work for the float but the other strings had % but it still wrote to the file anyway. Why is that?
Didn't notice the other fprintf's, you should drop the & unless your looking to print the address of a variable.
Also gets().. Never use gets always use fgets().
From my help files Never use gets(). Because it is impossible to tell without know‐
ing the data in advance how many characters gets() will read, and
because gets() will continue to store characters past the end of
the buffer, it is extremely dangerous to use. It has been used to
break computer security. Use fgets() instead.
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
But why didnt it work for the float but the other strings had % but it still wrote to the file anyway. Why is that?
Because c-string's are just arrays of characters delimited with '\0', so this means passing a c-string's variable name is the same as passing the address of the variable. It works, but it looks odd and my compiler fired off a warning about a type miss match.
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387