shithub: mc

ref: 8f6bfd8f7bf8c5ca162bdf49a94570e21e03ba3a
dir: /test/bio-unitwr.myr/

View raw version
use std
use bio

const main = {
	var f
	/* Must be bigger than a bio buffer (ie, > 64k) */
	var buf : byte[64*1024]

	match bio.create("tmpout/test-unitwr", bio.Wr, 0o644)
	| `std.Some bio:	f = bio
	| `std.None:	std.fatal(1, "Unable to open data file")
	;;
	
	/* write a byte */
	bio.putb(f, 42)

	/* and a char */
	bio.putc(f, 'ה')

	/* write a byte */
	bio.putb(f, 0xa)

	/* and test for flush on close */
	bio.close(f);
}