Fonction de recherche de ligne...
Bonjour, j'ai écrit une fonction pour lire la dernière ligne d'un fichier.
Mais elle plente avec le caractère "0" quand il se trouve dans le fichier...
Pouriez vous m'aider? J'ai esseiller avec !== mais sa ne fonctionne pas.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
//Récupération de la ligne actuèle :
$Act_Pos = ftell($this->output);
$Search_Pos = $Act_Pos - 3;//Remontée du dernier \n || \r || \r&&\n
fseek($this->output, $Search_Pos, SEEK_SET);
while($Char = fgets($this->output, 2))
{
if($Search_Pos == $Star_Pos)
{
fseek($this->output, 0, SEEK_SET);
break;
}
if($Char == "\n" || $Char == "\r")
break;
$Search_Pos--;
fseek($this->output, $Search_Pos, SEEK_SET);
}
$String = fread($this->output, 4096);
fseek($this->output, $Act_Pos, SEEK_SET);
return $String; |