Read Line
#1

I wanna read all the lines, but this just read the first line

pawn Код:
if (strcmp(cmd, "/read", true) == 0)
    {
        new File:example = fopen("procurados.txt", io_read);
        fread(example, string);
        fclose(example); //
        printf("%s",string);
        SendClientMessage(playerid, -1, string);
        return 0x01;
    }
Reply
#2

Use while
https://sampwiki.blast.hk/wiki/Fread
Reply
#3

pawn Код:
if (strcmp(cmd, "/read", true) == 0)
{
        new str[100]; //Increase if needed
        new File:example = fopen("procurados.txt", io_read);
        while(fread(example, str))
        {
              format(string, sizeof(string), "%s %s", string, str);
        }
        fclose(example);
        printf("%s",string);
        SendClientMessage(playerid, -1, string);
        return 0x01;
}
Give that a go.
Reply
#4

And how I delete the second line ? example:

/deleteline [line]
/deleteline 2
And this delete the line 2 ?

Thanks for your help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)