Reading lines from file
#1

Hi!
I have a quite large file with text, each text line is devided by \n or simply enter.
How can I read a random line from the file?
Reply
#2

Read the file with fread() n-times, so you move the pointer down
pawn Code:
new
    rand = random(20),
    i = 0;

while (i < rand)
{
    fread(file, string);
    i++;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)