[ CCode ( cname = "fwrite" , instance_pos = -1 ) ]
public size_t write (uint8[] buf, size_t size = 1)
Writes count of objects in the given array buffer to the output stream stream.
Example: Write a byte-buffer to the stream:
public struct Data {
public char l;
public char h;
public Data (char x) {
l = x.tolower ();
h = x.toupper ();
}
}
public static int main (string[] args) {
// array of 5 elements with size 2 bytes (2 * char)
Data [] mem = { Data('h'), Data('e'), Data('l'),
Data('l'), Data('o') };
// write array of 5 elements with 2 bytes size
stdout.write ((uint8[]) mem, sizeof (Data));
print ("\n");
return 0;
}
valac --pkg glib-2.0 GLib.FileStream.write.vala
size |
the number of the objects to be written |
buffer |
pointer to the first object object in the array to be written |
number of objects written successfully |