argument type mismatch?????
#1

PHP код:
new File:handle fopen(REGLOGio_read),buf[128];
if(
handle)
{
    while(
fread(handlebuf)) print(buf);
    
fwrite(handlestrval(buf) + 1);
    
fclose(handle);

Код:
dm_arena.pwn(319) : error 035: argument type mismatch (argument 2)
Error is in  fwrite(handle, strval(buf) + 1);
TY in advance...
Reply
#2

I could be completely wrong as I'm unfamiliar with fwrite, but I read up on the wiki. It appears you're converting a string to an integer and passing it into fwrite which wants a string that it can convert to an integer. Perhaps pass the string, let it be converted to an integer, then add + 1 to that value.
Reply
#3

The simplest solution would be

Код:
valstr(buf, strval(buf) + 1);
fwrite(handle, buf);
instead of

Код:
fwrite(handle, strval(buf) + 1);
This will compile but it will crash the server (or not write the line).

You open the file with mode io_read, but still attempt to write to it. Use io_readwrite.
Reply
#4

Thanks guys! I fixed it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)