以下控制字符的含义:

回车 换行 换页


当前回答

作为补充,

1、回车:这是打印机术语,意思是将打印位置更改到当前行的开头。在计算机世界中,它在大多数情况下表示返回到当前行的开始,但很少表示新行。

2、换行:这是打印机术语,意思是把纸张往前行。因此换行和换行一起使用,在新行开始时开始打印。在计算机世界中,它通常与换行符具有相同的含义。

3、表单提要:这是一个打印机术语,我喜欢这个帖子中的解释。

如果您正在为一台20世纪80年代风格的打印机编程,它将弹出 纸,开始新的一页。你几乎可以肯定永远不需要 它。 http://en.wikipedia.org/wiki/Form_feed

它几乎已经过时了,你可以参考转义序列\f - form feed -它到底是什么?详细说明。

注意,我们可以在某些平台上使用CR或LF或CRLF来代表换行符,但在其他一些平台上它们不能代表换行符。详见wiki Newline。

LF: Multics, Unix and Unix-like systems (Linux, OS X, FreeBSD, AIX, Xenix, etc.), BeOS, Amiga, RISC OS, and others CR: Commodore 8-bit machines, Acorn BBC, ZX Spectrum, TRS-80, Apple II family, Oberon, the classic Mac OS up to version 9, MIT Lisp Machine and OS-9 RS: QNX pre-POSIX implementation 0x9B: Atari 8-bit machines using ATASCII variant of ASCII (155 in decimal) CR+LF: Microsoft Windows, DOS (MS-DOS, PC DOS, etc.), DEC TOPS-10, RT-11, CP/M, MP/M, Atari TOS, OS/2, Symbian OS, Palm OS, Amstrad CPC, and most other early non-Unix and non-IBM OSes LF+CR: Acorn BBC and RISC OS spooled text output.

其他回答

Consider an IBM 1403 impact printer. CR moved the print head to the start of the line, but did NOT advance the paper. This allowed for "overprinting", placing multiple lines of output on one line. Things like underlining were achieved this way, as was BOLD print. LF advanced the paper one line. If there was no CR, the next line would print as a staggered-step because LF didn't move the print head. FF advanced the paper to the next page. It typically also moved the print head to the start of the first line on the new page, but you might need CR for that. To be sure, most programmers coded CRFF instead of CRLF at the end of the last line on a page because an extra CR created by FF wouldn't matter.

\f用于换页。 在控制台中看不到任何效果。但是当你在文件中使用这个字符常量时,你就能看到区别了。

另一个例子是,如果你可以将输出重定向到一个文件,那么你就不必写文件或使用文件处理。

为例:

用c++编写以下代码

void main()    
{
    clrscr();
    cout<<"helloooooo" ;

    cout<<"\f";
    cout<<"hiiiii" ;

}

当你编译它的时候,它会生成一个exe(for exe . abc.exe)

然后你可以使用这个重定向输出到一个文件:

ABC > xyz.doc

然后打开xyz.doc文件,您可以看到helloo和hiiii....之间的实际分页符

Carriage return and line feed are also references to typewriters, in that the with a small push on the handle on the left side of the carriage (the place where the paper goes), the paper would rotate a small amount around the cylinder, advancing the document one line. If you had finished typing one line, and wanted to continue on to the next, you pushed harder, both advancing a line and sliding the carriage all the way to the right, then resuming typing left to right again as the carriage traveled with each keystroke. Needless to say, word-wrap was the default setting for all word processing of the era. P:D

在老式的纸质打印机终端上,前进到下一行需要两个动作:将打印头移回水平扫描范围的起点(回车)和前进正在打印的纸卷(换行)。

由于我们不再使用纸质打印机终端,这些动作已经无关紧要了,但用来发出信号的字符以各种形式存在。

作为补充,

1、回车:这是打印机术语,意思是将打印位置更改到当前行的开头。在计算机世界中,它在大多数情况下表示返回到当前行的开始,但很少表示新行。

2、换行:这是打印机术语,意思是把纸张往前行。因此换行和换行一起使用,在新行开始时开始打印。在计算机世界中,它通常与换行符具有相同的含义。

3、表单提要:这是一个打印机术语,我喜欢这个帖子中的解释。

如果您正在为一台20世纪80年代风格的打印机编程,它将弹出 纸,开始新的一页。你几乎可以肯定永远不需要 它。 http://en.wikipedia.org/wiki/Form_feed

它几乎已经过时了,你可以参考转义序列\f - form feed -它到底是什么?详细说明。

注意,我们可以在某些平台上使用CR或LF或CRLF来代表换行符,但在其他一些平台上它们不能代表换行符。详见wiki Newline。

LF: Multics, Unix and Unix-like systems (Linux, OS X, FreeBSD, AIX, Xenix, etc.), BeOS, Amiga, RISC OS, and others CR: Commodore 8-bit machines, Acorn BBC, ZX Spectrum, TRS-80, Apple II family, Oberon, the classic Mac OS up to version 9, MIT Lisp Machine and OS-9 RS: QNX pre-POSIX implementation 0x9B: Atari 8-bit machines using ATASCII variant of ASCII (155 in decimal) CR+LF: Microsoft Windows, DOS (MS-DOS, PC DOS, etc.), DEC TOPS-10, RT-11, CP/M, MP/M, Atari TOS, OS/2, Symbian OS, Palm OS, Amstrad CPC, and most other early non-Unix and non-IBM OSes LF+CR: Acorn BBC and RISC OS spooled text output.