added file:write() & an optional mode param to os.open()

This commit is contained in:
2023-09-06 17:29:38 -05:00
committed by cpunch
parent d3de4c0e66
commit 3ea653b26d
4 changed files with 58 additions and 13 deletions

View File

@@ -1,9 +1,6 @@
local err, file = os.open("LICENSE.md")
print("made file")
if err then
print("failed to open file")
end
print(file)
print(file:read("a"))

6
examples/writer.cosmo Normal file
View File

@@ -0,0 +1,6 @@
local err, file = os.open("test.md", "w")
if err then
print("failed to open file")
end
file:write("hello world")