Difficulty with files in a C database [closed]

  1. Compile errors

    • addRecord() implementation is missing

    • typedef of c needs to be made before using it.

    • File *fp needs to be replaced by FILE *fp

  2. Other problems

    • createNew() sounds as if you want to create a new file “Customer.dat”, while access mode “r” opens an existing file for reading. Use “w” as access mode for creating a new file.
    • of course you should only call fclose(fp) if the prior fopen() call was successfull.
    • add_Customer() adds one more customer than desired (replace <= with < in the for loop)

and so on. I don’t believe that the list is complete…

Leave a Comment