error


Description:

[ CCode ( cname = "ferror" ) ]
public int error ()

Checks the given stream for errors.

Example: Check the given stream for errors:

public static int main (string[] args) {
// open an existing file for reading:
FileStream stream = FileStream.open ("test.txt", "r");
assert (stream != null);

// trigger an error by writing:
// Output: ``Error!``
stream.puts ("data");
if (stream.error () != 0) {
print ("Error!\n");
}

return 0;
}

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

Returns:

nonzero value if the file stream has errors occurred, 0 otherwise