Hi,
I have a C program that I have problem with.
The program shall read from an input folder on a share files located there. For each file I close the file also. Okay, now I know the file names in the input folder. After that I open the first text file again for processing the content in that file. Now, fopen get an error and the file cannot be open. If I execute this program with debug Athen the program executes correct. I can open the text file and process the file.
what can I do to prevent this error?
Regards
big spender
Saravanan GanesanPosted Sep 24, 2023, 5:02 PM
The issue you're facing may be related to the file not being properly closed before attempting to reopen it. Ensure that you close the file using
fclose()immediately after reading it for the first time. Failure to close the file could result in a file lock that prevents reopening. Also, double-check that your code handles file paths correctly, avoiding any potential issues with path separators. Finally, consider using a debugging tool to inspect the state of your program when the error occurs to identify any specific issues with file handling or resource management.Cr BhargaviPosted Sep 20, 2023, 10:35 AM
Hi Hakun, Can you please share the code to get the clarification
Sam HobbsPosted Sep 16, 2023, 3:53 PM
What C function are you using to open the file?
Lokesh VarmanPosted Sep 15, 2023, 10:40 AM
hi hakan,
Can i have a look at your program and the error. So that, I could help you further.