write


Description:

[ 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') };

stdout.write ((uint8[]) mem);
print ("\n");
return 0;
}

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

Parameters:

buf

pointer to the first object object in the array to be written

size

the element's size, this is always sizeof(uint8) or 1

Returns:

number of objects written successfully