Explain "fread"?
#1

Hi all,
Ive just begun on a house system that i will probably be releasing, if it all goes to plan, however i have come accross my first problem.

pawn Код:
fread
I dont understand it. I know about its handle, but lets say i have multiple strings in 1 file, how do i pick one of them? Can somebody explain fread, how to get certain strings (possibly on certain lines) and how it works?

Thanks
Ash
Reply
#2

fread:

file read.

Reads a file per line.
Reply
#3

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
fread:

file read.

Reads a file per line.
So to just read line 23 (for example) i would do?
Reply
#4

Here, I've just written this function for you to make it easier (put it at the end of the script (to make it easy)):
pawn Код:
freadLine(File: handle, line)
{
    new
        string[128]
    ;
    for(new x; x != line; x++)
    {
        fread(handle, string);
    }
    return string;
}
Example/Usage:
This function returns the info on the line you defined.

Example:
pawn Код:
new
    File: file = fopen("test.txt", io_read)
;
printf("%s", freadLine(file, 23));
This will give us all info which is on line 23. Just change the line to get other info.

Other questions about this let it know.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)