rewind


Description:

[ CCode ( cname = "rewind" ) ]
public void rewind ()

Moves the file position indicator to the beginning of the given file stream.

EOF and error flags are also cleared.

Example: Move the stream to the beginning of the file:

public static int main (string[] args) {
FileStream stream = FileStream.open ("test.txt", "w");
assert (stream != null);

// file content: "AAAAAAAA"
stream.puts ("AAAAAAAA\n");

// move the file pos back to 0:
stream.rewind ();

// overwrite the first 4 chars:
stream.puts ("BBBB");

// file content: ``BBBBAAAA``
return 0;
}

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