SA-MP Forums Archive
"fseek" doesn't work properly! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: "fseek" doesn't work properly! (/showthread.php?tid=622122)



"fseek" doesn't work properly! - Swedky - 19.11.2016

So I was making some tests with "fseek" and I found that it always return "0".
I used the Wiki example in a blank script and I get the same problem...

This is my script:

pawn Code:
public OnFilterScriptInit()
{
    new File:handle = fopen("file.txt", io_read);

    if(handle)
    {
        printf("Begin of file position: %d", fseek(handle, 0, seek_start));
        printf("End of file position: %d", fseek(handle, 0, seek_end));
        printf("Currrent file position: %d", fseek(handle, 0, seek_current));
        fclose(handle);
    }
    else print("Failed to open \"file.txt\".");
    return 1;
}
My "file.txt":

Code:
H20IBJWEKLBN23098NJWKLRGJSEFR
V2IGODSJF2J40G9JRENBJOVKSDFGJW4IOFTG4W
IW43GOSDIGJ4W9GHWG8ESOKGNSLV
G3I4OGWJH4OIGJUW0EIJSGLKDVMKGL
GWGNWONDISNSGDIOGDSOI420GN023I4N4GI01GT024IGJ40O3
42GI024NVO2ING2O4NGI2
Does it works for you?
Regards.


Re: "fseek" doesn't work properly! - SickAttack - 20.11.2016

https://sampforum.blast.hk/showthread.php?tid=364406

The code on the wiki doesn't even work.


Respuesta: "fseek" doesn't work properly! - Swedky - 20.11.2016

So I think that function works (seek in the file), but doesn't return what it should return.

I'll try to do it manually