#How to write ArrayList to BufferedWriter?
1 messages · Page 1 of 1 (latest)
_ = try buffered_writer.write(list.items);
// before end of scope
try buffered_writer.flush();
looks like you have a list of lists. for that you'll need to loop over tracks.items and do this for each one.
writeAll is not better?
cause write return a usize
i agree that writeAll() would be better.
i mean it might be better for things like writing to a network stream where partial writes might happen.
i'm writing to a file
not sure if you need it for a buffered writer
i would say its better practice to use writeAll(). but i've rarely had issues with write()
hmmm
i get a seg fault
by doing this
for (tracks.items) |track| {
try flpwriter.writeAll(track.items);
}
is there a trace?
not sure what might be causing it? any ideas? if not you'd have to show more code for me to help.
ok. how are you initializing each track?
ah there it is. you should not call array.deinit()
thank you!
let us know if you run into anything else
uhhh sorry to bother you but do you know how to append and not overwrite the existing bytes
if i seek like this
do you want to write to the end of a file? if so, there is a method seekFromEnd(0) i think