is the value of CR really platform dependant?
ambassador at fourthworld.com
Fri Aug 30 11:56:01 CDT 2002
Kee Nethery wrote:
> Someone said that I should take all my line endings in a text field
> and convert them to the constant CR because that will do the right
> thing per platform.
> Before I release something I'd like to know if that is true given
> that CR is not mentioned as a constant in my online docs nor in my
> 1.1.1 printed docs.
> On Mac OS X I know that the constant CR (commonly known as carriage
> return and commonly known as ascii(13) but not in revolution) =
> ascii(10) a linefeed
> Does CR = CRLF = ascii(13) and ascii(10) on windows?
> Does CR = ascii(13) on Mac OS 9?
> Does CR = linefeed ascii(10) on unix/Linux platforms?
The following is true on all platforms:
You can read as text or binary. Text mode converts line endings, binary
leaves everything as it is natively.
open file tMyFile for read
- OR -
open file tMyFile for text read
- OR -
put url ("file:"&tMyFile) into tMyData
open file tMyFile for binary read
- OR -
put url ("binfile:"&tMyFile) into tMyData
If you read in text mode, the line endings are handled for you automatically
on all platforms.
The reverse is also true: when writing to a file, text mode changes line
endings to whatever form is customary on the machine it's being run on.
Fourth World Media Corporation
Custom Software and Web Development for All Major Platforms
Developer of WebMerge 2.0: Publish any database on any site
Ambassador at FourthWorld.com http://www.FourthWorld.com
Tel: 323-225-3717 AIM: FourthWorldInc
More information about the use-livecode