Read next line in file
#8

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
Well, I'm not sure if the solution is THAT obvious. Because this guy over here is asking to find something in the file by searching for "4#", and the fread (on the SA:MP Wiki) only shows how to read line-by-line. However, it still should be easy ;p
No,actually the point was to direct the pawn to the line I want to extract and pack it into a string without searching for a string.
Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
There is currently no function to specify which lines to search by, but this may work.
PHP код:
stock readfile()
{
    new 
        
File:file fopen("file.txt"io_read),
        
string[128],
        
foundline 0;
    
    while(
fread(filestringsizeof(string)) {
        if((
strfind(string"#4") != -1) && !foundline) {
            
foundline 1;
            continue;
        }
        
        if(
foundline) {
            
printf("%s"string);
        }
    }
    return 
1;

Very impractical though.
Skipping lines ? smart,didn't thought about this.
anyway,found a solution,thanks you all for trying to help.
Reply


Messages In This Thread
Read next line in file - by Skillet` - 08.10.2012, 14:33
Re: Read next line in file - by Kwarde - 08.10.2012, 19:25
Re: Read next line in file - by Riddick94 - 08.10.2012, 19:27
Re: Read next line in file - by Kwarde - 08.10.2012, 19:29
Re: Read next line in file - by Riddick94 - 08.10.2012, 19:31
Re: Read next line in file - by Kwarde - 08.10.2012, 19:33
Re: Read next line in file - by ReneG - 08.10.2012, 22:32
Re: Read next line in file - by Skillet` - 08.10.2012, 23:56
Re: Read next line in file - by ReneG - 09.10.2012, 01:06

Forum Jump:


Users browsing this thread: 3 Guest(s)