rebol - Write a block array of data to a file -
i'm stuck on after many attempts, have array of items , i'm trying output file problem writes @ once , ignores newline. i'm beginning wonder if rebol has such simple ability. file1.txt contains multiple lines
myarray: [] foreach line read/lines %file1.txt [ append myarray line ] write %file2.txt myarray
this not work, written on 1 line
fp: open/new %file2 foreach line myarray [insert fp line] close fp
neither work "cannot use insert on port!"
i not trying copy file, above demonstration of i'm trying do.
rebol keeps newlines are. after reading read/lines block of items without newlines. if want block of items written lines separated newlines, should write them again refinement write/lines , rebol adds newlines again.
myarray: [] foreach line read/lines %file1.txt [ append myarray line ] write/lines %file2.txt myarray
Comments
Post a Comment