What could be some of the reasons for fopen to fail. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What could be some of the reasons for fopen to fail. (
/showthread.php?tid=432938)
What could be some of the reasons for fopen to fail. -
Nordic - 25.04.2013
i fixed this issue.
Re: What could be some of the reasons for fopen to fail. -
MP2 - 25.04.2013
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.
Re: What could be some of the reasons for fopen to fail. -
MP2 - 25.04.2013
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.
Re: What could be some of the reasons for fopen to fail. -
Nordic - 25.04.2013
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.
Re: What could be some of the reasons for fopen to fail. -
Ada32 - 25.04.2013
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.