Typing issue with core:encoding/csv.writer_init

Hello everyone,
I am new to Odin and to low-level programming (only worked with Python for ~8 years).
I would like to create a proc() that saves a matrix into a csv file.
My problem is that I first try to create the file handler through:

handle, err = os.create(filename)

and pass the stream to the writer initialiser:

writer : csv.Writer
csv.writer_init(&writer, handle.stream)

Apparently, handle.stream is of type File_Stream, while the procedure requires io.Stream. But i can’t find in the documentation how to get this type for a newly created file. I also got a similar problem with the csv reader but i found a workaround using csv.reader_init_with_string.

Do you have an idea about what I am missing or is it a bug? Thanks in advance for your help

Use os.to_stream

writer : csv.Writer
csv.writer_init(&writer, os.to_stream(handle))
1 Like