Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] areas, text, and read/binary

From: reboler::programmer::net at: 11-Feb-2002 14:02

I am reading file contents with 'read/binary, because the file may be text or an image. If the file is text then I display those contents in an 'area with 'to-string contents. I can edit those contents, and then would like to save the changed contents (my-area/text). Here is the problem: the line terminators in the saved text seem to multiply. i.e. with each new save of the text an additional line terminator is added to the end of each line. Is there a way to avoid this? Is it something unique to the way 'areas handle, maybe to do with 'wrap?. I have tried various combinations of wrap?: true/false, write/string etc, and trim/auto etc with no success. Keep in mind that for reasons not mentioned here I would always like to 'read/binary to get the file contents, whether text file or image file. (I know this problem disappears if I just 'read text files, but it makes the script very much more complicated in several places). Problem in short: Can I read a file as binary, edit it's contents with 'to-string in an area/text, and then write it without REBOL adding extraneous line-terminators?