Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/11/2005, 10:23
Cluster
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
En principio .. si leyeses tu archivo sobre un array (como file() por ejemplo te lo entregará directamente) podrías luego usar las funciones de array's (arreglos, matrizes...) para acceder a los elementos que quieras u operar en general con ese archivo. Recuerda que un archivo de texto plano es de lectura "secuencial".

De todas formas ... en la documentación oficial de fseek() veras alternativas para leer líneas de un archivo de texto plano como por ejemplo:
Cita:
Lutz ( l_broedel at gmx dot net )
15-Feb-2005 12:25
Based on the function below, provided by info at o08 dot com (thanks), the following should enable you to read a single line from a file, identified by the line number (starting with 1):

Código PHP:
<?
   
function readLine ($linenum,$fh) {
       
$line fgets ($fh4096);
       
$pos = -1;
       
$i 0;

       while (!
feof($fh) && $i<($linenum-1)) {
           
$char fgetc($fh);
           if (
$char != "\n" && $char != "\r") {
               
fseek($fh$posSEEK_SET);
               
$pos ++;
           }
           else 
$i ++; 
       }
       
$line fgets($fh);
       return 
$line;
   } 
//readLine()
?>
www.php.net/file
www.php.net/fseek

Un saludo,