28.03.2019, 18:18 
	
	
	
		Is there a way to read a log file backwards because i've been looking for solution but nothing found.
Can someone help me with that.Thanks
	
	
	
Can someone help me with that.Thanks
Function:Reverse(string[])
{
// Setting vars
new string1[256];
lengthOfString = strlen(string);
// Processing
for(new i = 0; i < strlen(string); i++)
{
string1[i] = string[(lengthOfString-i)];
}
// Returning processed string
return string1;
}
// Open "file.txt" in "read only" mode
new File:handle = fopen("file.txt", io_read);
 
// If "file.txt" is open
if(handle) {
    // Jump to the last byte of "file.txt", and print its position
    printf("End of file position: %d", fseek(handle, 0, seek_end));
    fclose(handle);
} 
| 
 You can try experimenting with something like: 
PHP Code: 
 | 
while(fread(handle, data))
function givendmg_load(playerid){
    new f[64]; format(f, 64, givendmg_file, GetName(playerid));
    new Data[256], x=0, arrCoords[6][64];
    new File:handle = fopen(f, io_read);
    
    if(!fexist(f)) return printf("File %s ne postoji te se sistem nije ucitao", f);
    
    while(fread(handle, Data)){
        split(Data, arrCoords, ',');
        strmid(givendmgInfo[playerid][x][dmgDate], arrCoords[0], 0, strlen(arrCoords[0]));
        strmid(givendmgInfo[playerid][x][dmgTime], arrCoords[1], 0, strlen(arrCoords[1]));
        strmid(givendmgInfo[playerid][x][dmgGivenTo], arrCoords[2], 0, strlen(arrCoords[2]));
        strmid(givendmgInfo[playerid][x][dmgGivenBy], arrCoords[3], 0, strlen(arrCoords[3]));
        givendmgInfo[playerid][x][dmgAmount] = strval(arrCoords[4]);
        givendmgInfo[playerid][x][dmgWeapon] = strval(arrCoords[5]);
        x++;
    }
    fclose(handle);
    return 1;
} 
	| 
 https://forum.sa-mp.com/showpost.php...82&postcount=8 
This should be what you are looking for. It doesn't actually read the file backwards, but it creates a copy with reversed line order which you can open afterwards and use regular file functions. You must define MAX_LINE_LENGTH to what you guess will be the max. line length. Unfortunately it buffers each line so that is required to know.  |