Page 1 of 1

From Mac OS X - Write file with CRLF

Posted: Mon Mar 22, 2010 3:34 am
by bobcole
Good citizens of the Talking Revolution Forum:
Using Mac OS X (10.5.8 PPC), I am trying to write a file with Windows (CRLF) line endings so I can pass it to another program that expects Windows (DOS) line endings. The dictionary says that Revolution automatically translates line endings and writes a file with the line ending that are appropriate for the computer platform; consequently, I find my file always has Mac endings (CR). I see that it is possible to write with a binary option that will avoid the translation but how do I get the LFs into the lines before a binary write operation?
As a work around, I created an AppleScript that tells TextWrangler to load the Mac file (CR) from disk, change the line endings to DOS (CRLF) and then save it. That works but it is a bit of kludge.
I am curious if there is a more direct method to creating a CRLF file.
Thanks in advance,
Bob

Re: From Mac OS X - Write file with CRLF

Posted: Mon Mar 22, 2010 4:42 am
by FourthWorld
replace cr with crlf in tData
put tData into url ("binfile:"& tFile)

Re: From Mac OS X - Write file with CRLF

Posted: Mon Mar 22, 2010 9:50 pm
by bobcole
Richard:
That worked. As usual with Rev, many things are easier than they seem at first.
Thank you,
Bob