In eofnormalize(), a call to a file positioning function is needed between input and output.
I no longer can edit my post, but I'd change the function to:
#include <stdio.h>
int...
Type: Posts; User: qny
In eofnormalize(), a call to a file positioning function is needed between input and output.
I no longer can edit my post, but I'd change the function to:
#include <stdio.h>
int...
My code works for me:
#include <stdio.h>
#include <stdlib.h>
int eofnormalize(const char *fname) {
FILE *h;
int ch;
if ((h = fopen(fname, "a+b")) == NULL) return 1;
Is this the expected outcome?
You opened the FILE for append mode, but then try to read from it ... this is a big no no: don't do that!
Open the file for reading / appending in binary mode like I suggested
if (...
Untested:
FILE *inSalesPtr;
//open the file for binary read/append
if ((inSalesPtr = fopen("sales.txt", "a+b")) == NULL) exit(1); /* exit on error */
// set the file position to the very...