write_file

This commit is contained in:
IgorCielniak
2025-12-18 11:32:35 +01:00
parent 6efd7c4e19
commit 50451840b7
32 changed files with 3064 additions and 24 deletions

20
test_write_file.sl Normal file
View File

@@ -0,0 +1,20 @@
import stdlib/stdlib.sl
import stdlib/io.sl
: main
"/tmp/l2_test_write.txt" # push path (len addr)
swap # -> (addr len) = path_ptr path_len
"hello from write_file test\n" # push buf (len addr)
swap # -> (addr len) = buf_ptr buf_len
2swap # reorder pairs -> path_ptr path_len buf_ptr buf_len
write_file
dup 0 > if
"wrote bytes: " puts
puts
0
exit
then
"write failed errno=" puts
puts
exit
;