转义序列 \f - 换页 - 它到底是什么?
\f
被认为是换页符。 \t
是制表符,\a
是蜂鸣声,\n
是换行符。换页符到底是什么 - \f
?以下程序
#include <iostream>
int main()
{
std::cout << "hello\fgoodbye" << std::endl;
}
打印hello
,然后打印女性符号(颠倒的圣手榴弹:),然后再见
全部写在一行上。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
它跳到下一页的开头。 (主要适用于输出设备是打印机而不是 VDU 的终端。)
It skips to the start of the next page. (Applies mostly to terminals where the output device is a printer rather than a VDU.)
来自 wiki 页面
或更多详细信息此处。
看来这个符号现在已经相当过时了,它的处理方式可能是(?)依赖于实现的。至少对我来说,您的代码给出以下输出(xcode gcc 4.2,gdb 控制台):
From wiki page
or more details here.
It seems that this symbol is rather obsolete now and the way it is processed may be(?) implementation dependent. At least for me your code gives the following output (xcode gcc 4.2, gdb console):
如果您正在为1980年代风格的打印机编程,它将弹出纸张并启动新页面。您几乎可以肯定不需要它。
http://en.wikipedia.org/wiki/Form_feed
If you were programming for a 1980s-style printer, it would eject the paper and start a new page. You are virtually certain to never need it.
http://en.wikipedia.org/wiki/Form_feed
它来自fan-fold paper.
Trust me, you ain't gonna need it...
It comes from the era of Line Printers and green-striped fan-fold paper.
Trust me, you ain't gonna need it...
Although recently its use is undefined, a common and useful use for the form feed is to separate sections of code vertically, like so:
(from http://ergoemacs.org/emacs/emacs_form_feed_section_paging.html)
Although recently its use is undefined, a common and useful use for the form feed is to separate sections of code vertically, like so:
(from http://ergoemacs.org/emacs/emacs_form_feed_section_paging.html)
的末端启动第二行
它要转到newline,然后添加空格以在第一行输出
It's go to newline then add spaces to start second line at end of first line
Output