Everything is fine except for Case 5. I need to add a book from the user. It lets me to write it to the .dat file, but when I try to run it again I get an error saying string out of rang. How do I fix that? I only posted case 5 because everything else works
No no no, you didn't understand me. Use code tags means: enclose your code in [.code] [./code] (without the dots). This way your code looks neat instead of copy-pasted plaintext terror.
Okay. What is BOOKS_data? The code isn't complete, and sometimes might not make sense(what is p? what is make_book? what is catalog?), but if I were to guess, you first open open BOOKS_data somewhere in the program, close it in case 5, and then run again with BOOKS_data closed. I might be wrong however - it would be nice if we could get full output and maybe some stack trace.