I want to write some logs in file.
This is my Code:
FILE *writefile = fopen((Dir + FileName).data(), "at");
if (writefile)
{
fprintf(writefile, log.data());
fclose(writefile);
}
It surely works the first time when I try to write.
This code is executed in networking system, but it is executed in no connection status.
So, it keeps writing log "Try Connct" in every sec.
This is the image what I want to write
I can see these log on my console.
In image, I try to write log over 11:10:00.
But in File, it was not written until 11:06:00.
I try to debug my code,
This is the image in debugging
Why this happens?
---Addition---
I try to print error. So, I used perror.
I got Error : Too many open files.
But Why? Obviously I closed file, as you can see in my code.