请问哪里可以查到全部的转义符?

yangtian_yan 2008-03-03 11:36:59
同题
...全文
115 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
效率真高呀
yangtian_yan 2008-03-04
  • 打赏
  • 举报
回复
谢谢!
mymtom 2008-03-04
  • 打赏
  • 举报
回复
在ISO C标准文本里!
2 Alphabetic escape sequences representing nongraphic characters in the execution
character set are intended to produce actions on display devices as follows:
\a (alert) Produces an audible or visible alert. The active position shall not be changed.
\b (backspace) Moves the active position to the previous position on the current line. If
the active position is at the initial position of a line, the behavior is unspecified.
\f ( form feed) Moves the active position to the initial position at the start of the next
logical page.
\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.
\t (horizontal tab) Moves the active position to the next horizontal tabulation position
on the current line. If the active position is at or past the last defined horizontal
tabulation position, the behavior is unspecified.
\v (vertical tab) Moves the active position to the initial position of the next vertical
tabulation position. If the active position is at or past the last defined vertical
tabulation position, the behavior is unspecified.


6.4.4.4 Character constants
Syntax
1 character-constant:
’c-char-sequence’
L’c-char-sequence’

c-char-sequence:
c-char
c-char-sequence c-char
c-char: *
any member of the source character set except
the single-quote ’, backslash \, or new-line character
escape-sequence
escape-sequence:
simple-escape-sequence
octal-escape-sequence
hexadecimal-escape-sequence
universal-character-name
simple-escape-sequence: one of
\’ \" \? \\
\a \b \f \n \r \t \v
octal-escape-sequence:
\ octal-digit
\ octal-digit octal-digit
\ octal-digit octal-digit octal-digit
hexadecimal-escape-sequence:
\x hexadecimal-digit
hexadecimal-escape-sequence hexadecimal-digit
星羽 2008-03-04
  • 打赏
  • 举报
回复
星羽 2008-03-04
  • 打赏
  • 举报
回复
MSDN


Character combinations consisting of a backslash (\) followed by a letter or by a combination of digits are called "escape sequences." To represent a newline character, single quotation mark, or certain other characters in a character constant, you must use escape sequences. An escape sequence is regarded as a single character and is therefore valid as a character constant.

Escape sequences are typically used to specify actions such as carriage returns and tab movements on terminals and printers. They are also used to provide literal representations of nonprinting characters and characters that usually have special meanings, such as the double quotation mark ("). The following table lists the ANSI escape sequences and what they represent.

Note that the question mark preceded by a backslash (\?) specifies a literal question mark in cases where the character sequence would be misinterpreted as a trigraph. See Trigraphs for more information.

Escape Sequences
Escape Sequence Represents
\a
Bell (alert)

\b
Backspace

\f
Formfeed

\n
New line

\r
Carriage return

\t
Horizontal tab

\v
Vertical tab

\'
Single quotation mark

\"
Double quotation mark

\\
Backslash

\?
Literal question mark

\ooo
ASCII character in octal notation

\xhh
ASCII character in hexadecimal notation

\xhhhh
Unicode character in hexadecimal notation if this escape sequence is used in a wide-character constant or a Unicode string literal.

For example, WCHAR f = L'\x4e00' or WCHAR b[] = L"The Chinese character for one is \x4e00".


Microsoft Specific

If a backslash precedes a character that does not appear in the table, the compiler handles the undefined character as the character itself. For example, \c is treated as an c.

64,654

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧