Descrizione
string
fgetc ( resource handle )
Restituisce una stringa contenente un singolo carattere letto dal file puntato
da handle.
Restituisce FALSE alla fine del file (EOF).
The file pointer must be valid, and must point to
a file successfully opened by fopen() or
fsockopen().
Avvertimento |
Questa funzione puņ
restituire il Booleano FALSE, ma puņ anche restituire un valore non-Booleano valutato
come FALSE, come ad esempio 0 o
"". Per favore fare riferimento alla sezione Booleans per maggiori
informazioni. Usare l'operatore
=== per controllare il valore restituito da questa
funzione. |
Esempio 1. Un esempio per fgetc()
<?php $fp = fopen('somefile.txt', 'r'); if (!$fp) { echo 'Non si riesce ad aprire il file somefile.txt'; } while (false !== ($char = fgetc($fp))) { echo "$char\n"; } ?>
|
|
Nota: Questa funzione č
binary-safe (gestisce correttamente i file binari)
Vedere anche fread(), fopen(),
popen(), fsockopen() e
fgets().