interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / omc / om2 / s4 / v-pwrite-text.om

19 lines · 359 bytes Raw Blame History
1note S4: pwrite only reads its array, so a text and a view are allowed (error 20 is for pread).
2note Writes ABC at file position 0 and a newline at 3 of stdout (exit 0).
3om2
4text t "ABC"
5fn g v view uchar * to long
6ret pwrite 1 v 0 len v 0
7end
8fn main to int
9r = g t
10if ne r 3
11ret 1
12end
13nl = new uchar 1 10
14r = pwrite 1 nl 0 1 3
15if ne r 1
16ret 2
17end
18ret 0
19end