File Functions in PAWN
#1

hi everyone hope someone can help me with this Filesystem?

Destination: Extract a String at a specific position from a File.

I can't find the procedure for this?

PS: If it's possible i don't really want to read in the whole file cause it costs speed.

(If there doesn't exist such a function.
For example, how can I read line 3 From a Textfile in PAWN in an easy way?)
Reply
#2

Do you use the default file functions? If so, you can use a while loop to only read one line at a time, then break the loop when you find the line you want.
Reply
#3

You mean I could just change the while-loop for a for-loop counting to 3 and break it?
Reply
#4

Not really, no. The way you'll read one line at a time, you'll need to use it this way
pawn Code:
while( fread( file ))
So to do what you want, you'll have to declare a variable before the loop and increase it. For example:
pawn Code:
new
    i;
while( fread( file ))
{
    if( i == 2 )
    {
        //3th line is reached (i = 0 - line 1, i = 1, line 2 etc.)
    }
    i ++;
}
Reply
#5

Thanks It's so simple. (First thinking than asking, sry)
thanks it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)