getc


Description:

[ CCode ( cname = "fgetc" ) ]
public int getc ()

Reads the next character from the given input stream.

Example: Read chars from the stream:

public static int main (string[] args) {
// Opens "foo.txt" for reading ("r")
FileStream stream = FileStream.open ("filestream.vala", "r");
assert (stream != null);

// Char by char:
int c = 0;
while ((c = stream.getc ()) >= 0) {
stdout.putc ((char) c);
}

return 0;
}

valac --pkg glib-2.0 GLib.FileStream.getc.vala

Returns:

next character from the stream or GLib.FileStream.EOF if an error has occurred or the end of file has been reached.