"Permission Denied" error reading file
I'm looking for troubleshooting suggestions or insights. I'm using Microsoft Visual C++ Version 6. In my MFC application, I can read part of a text file with fgets but, if at some point during that, I open an output file, I then get a "Permission Denied" error (using strerror) on the next fgets and cannot read the rest of the text file. Any ideas?
RE: "Permission Denied" error reading file
Yes, I write to the directory in other programs without a problem. What's even odder, this "Permission Denied" error occurs on the second pass through this piece of code. On the first pass, opening the output file doesn't cause an error, and I can read to the end of the text file. After I posted, I found that if I do _fcloseall() before opening the text file, then I do not get the error. So if that survives rigorous testing, then it's a viable solution. I close the output file if needed before opening a new one, but apparently something there is amiss. I'm just not sure what.