Home / Highlights / FAQ / Examples / Quick Start / Download Forum / Register / Login
This is a simple example of using the read stream.
/tmp/numbers:
0
1
2
Source:
main()
{
	array := $u8[]
	r := OpenFile("/tmp/numbers")
	while !r.IsEOF()
	{
		r.BufferLine()
		if r.IsEOL()
			continue
		//We'll print the array so the optimizer doesn't delete everything
		//Print treats the array as binary data. Here's an easy way to make everything ascii 0-7
		array.Push(r.Int() & 7 + '0') //Operator precedence is different than C
		r.WS().ExpectEOL()
	}
	assert(!r.HasError);
	print(array)
}