What could be some of the reasons for fopen to fail.
#1

i fixed this issue.
Reply
#2

I just ran this code:

pawn Код:
public OnFilterScriptInit()
{
    new File:f = fopen("test.txt", io_write);
    fwrite(f, "first");
    fclose(f);
    return 1;
}
It wrote in the file. BUT, when I removed the fclose (commented it out) - nothing was written. It seems you're right - you've missed an fclose(). Not sure how you could go about fixing this.
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
Have you actually tried testing your theory and looked for missing file closes?
How exactly would one go about that? I'm wondering.
Reply
#4

I don't think file permission, directory, or harddrive error could cause this problem, because I can fix it temporarily by restarting the server. It'll last another week or so before it happens again. I will test this fclose thing tonight.
Reply
#5

Quote:
Originally Posted by Nordic
Посмотреть сообщение
I don't think file permission, directory, or harddrive error could cause this problem, because I can fix it temporarily by restarting the server. It'll last another week or so before it happens again. I will test this fclose thing tonight.
Those are ALL valid reasons why file operations may fail. Code doesn't work one minute and not seem to the other, either there was a change in code or something external is affecting what it is supposed to do.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)