native fclose () problem! - 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: native fclose () problem! (
/showthread.php?tid=637077)
native fclose () problem! -
MrAjusshi - 08.07.2017
I have this error "#0 native fclose () from samp03svr" from crashdetect on my server log.
I am not quite sure what is the problem here.. I've search for this problem and find similar problem to my problem but didn't work very well so I think, I should start new thread.
pawn Код:
stock AppendTo(filename[],string[])
{
if(!fexist(filename))
{
new File:myfile=fopen(filename,io_write);
fclose(myfile);
}
new File:myfile=fopen(filename,io_append);
new timestring[MAX_STRING];
if(strcmp(filename,"phones.ini",true)==0)
{
format(timestring,sizeof(timestring),"%s",string);
fwrite(myfile,timestring);
fclose(myfile);
return 1;
}
if(strcmp(filename,"commands.log",true)==0)
{
format(timestring,sizeof(timestring),"%s\n",string);
fwrite(myfile,timestring);
fclose(myfile);
return 1;
}
new hour,minu,seco,giorno,mese,anno;
gettime(hour,minu,seco); getdate(anno,mese,giorno);
format(timestring,sizeof(timestring),"[%d:%d:%d/%d-%d-%d]%s\n",hour,minu,seco,giorno,mese,anno,string);
fwrite(myfile,timestring);
fclose(myfile);
return 1;
}
pawn Код:
stock Debug(string[])
{
SendClientMessageToAdmins(string,COLOR_GREEN);
print(string);
new newstring[MAX_STRING]; format(newstring,sizeof(newstring),"%s\n",string);
if(!fexist(debuglog))
{
new File:myfile=fopen(debuglog,io_write);
fwrite(myfile,newstring);
fclose(myfile);
}
new File:myfile=fopen(debuglog,io_append);
fwrite(myfile,newstring);
fclose(myfile);
return 1;
}
Edit:
It work very well with windows (.dll plugins) but not with Linux (.so plugins even though all plugins work very well and loaded as well)
Edit: Fixed
Re: native fclose () problem! -
Fairuz - 08.07.2017
Linux is case sensitive,make sure the file name is right.
for example,the file name should be commands.log not Commands.log.
Re: native fclose () problem! -
MrAjusshi - 08.07.2017
Nope, still same.