SA-MP Forums Archive
Can't open file - 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: Can't open file (/showthread.php?tid=557835)



Can't open file - Brooks1 - 15.01.2015

Hello, I have a problem. When I use this code it can't open the file, but the directory exists.
Here is the code:

Код:
new File:hFile = fopen("TEST/Test.txt",io_append);
if(!hFile) SendClientMessage(playerid,-1,"TEST");
This code returns the message ---> TEST
That means the file's is not opened, but the directory exists.
But when I delete the file and creates it again there isn't a problem.

Sorry for my bad English.


Re: Can't open file - danish007 - 15.01.2015

use this...
pawn Код:
new Path[ 64 ], string[ 128 ];

format( Path,sizeof( Path ),"TEST/Test.txt");

if ( fexist( Path ) )
{
     new File:hFile = fopen("Path",io_append);
}
else SendClientMessage(playerid,-1,"TEST");



Re: Can't open file - Brooks1 - 15.01.2015

Doesn't work


Re: Can't open file - danish007 - 15.01.2015

which errors you got?
make sure you are using correct path.. to open a file


Re: Can't open file - Brooks1 - 15.01.2015

I don't getting errors, the code is correct. The directory exists, but can't open it.


Re: Can't open file - Brooks1 - 15.01.2015

I have the same problem: https://sampforum.blast.hk/showthread.php?tid=454367


Re: Can't open file - danish007 - 15.01.2015

make sure you've created the directory in scriptfiles as you defined in Path...


Re: Can't open file - BroZeus - 15.01.2015

try running server in as admin(administrator privileges in windows)
And make sure the directory is as follows
Server_Folder/Scriptfiles/Test/TEST.txt
And also make sure the directory is in same case as you are using in script