Originally Posted by
anduril462
Does employee.dat exist? You need to check the return value of fopen before trying to do anything with file. The program crashed for me, then when I created an empty employee.dat, it worked without crashing.
I used a debugger to solve this, and it took me about 1 minute. You should also learn to use a debugger, as it is an invaluable tool and will help you track down these issues yourself. It allows you to step through the code line by line and see exactly what the value of each variable is and often takes you to the exact line that causes your crash.