ungetc
Description:
Puts the character ch back to the given file stream.
Example: "Unget" a character:
static int main (string[] args) {
FileStream stream = FileStream.open ("GLib.FileStream.ungetc.vala", "r");
assert (stream != null);
while (stream.eof () == false) {
// get first char of each line
int c = stream.getc ();
if (c == '#') {
// ignore comments
stream.read_line ();
} else if (c >= 0) {
stream.ungetc (c);
print (stream.read_line ());
print ("\n");
}
}
return 0;
}
valac --pkg glib-2.0 GLib.FileStream.ungetc.vala
Parameters:
c |
character to be put back |
Returns:
buf on success, |