What is the value of '\n' under C compilers for old Mac OS?

前端 未结 5 1590
孤街浪徒
孤街浪徒 2021-01-01 08:44

Background:

In versions of Mac OS up to version 9, the standard representation for text files used an ASCII CR (carriage return) character, value decimal 13, to mark

5条回答
  •  太阳男子
    2021-01-01 09:00

    I don't have an old Mac compiler to check if they follow this, but the numeric value of '\n' should be the same as the ASCII new line character (given that those compilers used ASCII compatible encoding as the execution encoding, which I believe they did). '\r' should have the same numeric value as the ASCII carriage return.

    The library or OS functions that handle writing text mode files is responsible for converting the numeric value of '\n' to whatever the OS uses to terminate lines. The numeric values of these characters at runtime are determined entirely by the execution character set.

    Thus, since we're still ASCII compatible execution encodings the numeric values should be the same as with classic Mac compilers.

提交回复
热议问题