Can't open file
#1

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.
Reply
#2

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");
Reply
#3

Doesn't work
Reply
#4

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

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

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)