Thank you. Something I still can't understand and if you clear it for me I'd appreciate. Why is fgets returning -1?(even after deleting the code you mentioned). I understand that fgets would be NULL if the file is empty or EOF
Thank you. Something I still can't understand and if you clear it for me I'd appreciate. Why is fgets returning -1?(even after deleting the code you mentioned). I understand that fgets would be NULL if the file is empty or EOF
Last edited by aidan4; 03-06-2021 at 07:23 PM.
Oh, but now that's something else. It is not fgets itself that returns -1: it is the code in the body of the read_coords (or read_file) function that returns -1, if fgets returns a null pointer.Originally Posted by aidan4
This should not be happening since the file should have the content that you described. Since it is happening yet you can open the file for reading, it implies that the file is actually empty. If you really do believe that the file contains something, then what I suggest is that you post the program that you're testing with (it should be a small and contained example like my program from post #8) as well as the entire test input file (post it in code tags).
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)