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

前端 未结 5 1559
孤街浪徒
孤街浪徒 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:18

    On older Mac compilers, the roles of \r and \n where reversed: We had '\n' == 13 and '\r' == 10, while today '\n' == 10 and '\r' == 13. Great fun during the transition phase. Write a '\n' to a file with an old compiler, read the file with a new compiler, and get a '\r' (of course, both times you actually had a number 13).

提交回复
热议问题