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

前端 未结 5 1591
孤街浪徒
孤街浪徒 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 08:56

    C-language specification:

    5.2.2
    ...
    2 Alphabetic escape sequences representing nongraphic characters in the execution character set are intended to produce actions on display devices as follows:
    ...
    \n (new line) Moves the active position to the initial position of the next line.
    \r (carriage return) Moves the active position to the initial position of the current line.

    so \n represents the appropriate char in that character encoding... in ASCII is the LF char

提交回复
热议问题