$fgetc

From Scriptwiki
Revision as of 19:43, 19 December 2005 by Doomie (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Returns the next character.

$fgetc(name | N)


$fgetc automatically moves the pointer to the next character if used.

Example

Let's assume we have a text file called moo.txt in our mircdir. It has the following content:

one
two
three

Let's also assume we have opened it using the following command: fopen moo moo.txt


echo -a $fgetc(moo)

Would return the first character of the first line (o).


while (!$feof(moo)) {
 echo -a $fgetc(moo)
}

This would echo the ascii value of every char in the file moo.txt, as the pointer will moved to the next char everytime $fgetc will be used.