Ciao ..
io avrei l'esigenza di leggere riga per riga un file txt
il problema è che se indico il numero di bite della lunghezza del record, mi ci si infila evidentemente un carattere di fine riga
che mi sfasa tutto ..
come posso rimediare ?
grazie mille
- file da leggere:
34101
34102
34217
34229
34253
34254
34264
- istruzione:
Codice PHP:
$file_input = fopen('file_input_em.txt', "r");
while (!feof($file_input))
{$id_file = fread($file_input, 5);
if (!empty($id_file))
{
++$num_righe_lette;
echo "Riga input - id : " . $id_file . "
"; //#
//verifica_riga($id_file, $db, $file_em_down, $file_em_ko);
}
}
fclose($file_input);
- risultato
Riga input - id : 34101
Riga input - id : 3410
Riga input - id : 2 342
Riga input - id : 17 34
Riga input - id : 229 3
Riga input - id : 4253
Riga input - id : 34254
Riga input - id : 3426
Riga input - id : 4