$filename = "prova.txt";
$acapo = chr(13) + chr(10);
$str = "Questa e' la prova di un file testo" .$acapo . "con questa riga a
capo" . $acapo . "e con questa pure." . $acapo;
$handle = fopen($filename,"w");
if ($handle == false) {
echo "errore fopen";
exit;
}
if (fwrite($handle, $str) === FALSE) {
echo "Cannot write to file ($filename)";
fclose($handle);
exit;
}
fclose($handle);
echo "Ok";
ma se apro il file con un editor esadec. non trovo i caratteri voluti.
Grazie
--
questo articolo e` stato inviato via web dal servizio gratuito
http://www.newsland.it/news segnala gli abusi ad ab...@newsland.it
> Dovrei generare un file testo che righe di lunghezza fissa e con al
> termine i caratteri esadecimali "0D" e "0A" che dovrebbero
> corrispondere a CF LF
> ho provato:
>
> $filename = "prova.txt";
> $acapo = chr(13) + chr(10);
Tralasciando che puoi utilizzare \r\n (vedi
http://www.php.net/manual/it/language.types.string.php), l'operatore di
concatenazione delle stringhe in PHP è . (punto, vedi
http://www.php.net/manual/it/language.operators.string.php).
$acapo = chr(13) . chr(10);
--
Vuoi distribuire il tuo sito web su CD/DVD?
Prova http://www.dwebpro.com/
Vuoi diventare un esperto analista PHP/MySQL?
Vieni a fare uno stage con noi: http://www.creativepark.it/stage/
> $acapo = chr(13) . chr(10);
ho trovato !
$acapo = "x0Dx0A";