fwrite crashes server - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: fwrite crashes server (
/showthread.php?tid=577002)
fwrite crashes server -
Hotelgast - 08.06.2015
Hi,
Whenever I attempt to start up the samp-server I get a native fwrite crash:
[debug] AMX backtrace:
[debug] #0 native fwrite () [00405710] from samp-server.exe
Any ideas how to resolve this issue? I have tried to search on the sa-mp forums and elsewhere however so far I have not yet found a solution.
Regards,
Hotelgast
Re: fwrite crashes server -
Konstantinos - 08.06.2015
https://sampwiki.blast.hk/wiki/Fwrite
By checking if the file handle is valid, it prevents the crash. So instead of doing this:
pawn Код:
new File: fhandle = fopen(...);
fwrite(fhandle, "...");
fclose(fhandle);
would be:
pawn Код:
new File: fhandle = fopen(...);
if (fhandle)
{
fwrite(fhandle, "...");
fclose(fhandle);
}