Search code examples
newlinered-lang

red how to write newlines to output file


I'm working in Windows and appending lines to a text file in Red using

write/append/lines %MC_testfile.txt "output text here"

And the output text is duly appended but not on a new line. How do I get my appended text on a new line?


Solution

  • You appear to be encountering a bug that was fixed very recently (apparently more recently than the build you are using):

    Issue #2430: write/lines only writes end-of-lines if argument is block

    FIX: issue #2430

    Two resources to help with this kind of thing in the future:

    Given Red's early state, it's good to do a keyword search in the issues database before posting to StackOverflow. You should search on all issues (the search defaults to open, but you can remove that clause to get closed ones too). It would have found this one:

    GitHub Query Filter is:issue write/lines

    You also might find a related issue that helps inform whatever you're seeing.

    The other thing to know about is the automated builds of the master branch from the download page:

    http://www.red-lang.org/p/download.html

    If reporting a problem to a project, it always helps to try it in both the stable and the latest, to see if it's a regression or possibly fixed.