c++ - Xcode下写c,遇到的转义符\r失效的问题?
迷茫
迷茫 2017-04-17 15:00:05
0
2
670

在xcode下写C,使用语句: printf("a\rbb");
\r不是回到行首的意思吗?理论上应该输出bb (因为回到行首,bb把a覆盖掉)
但实际上输出的是:
a
bb (编译器吧\r 等同于 \n ???)

如何解决这个问题?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
PHPzhong

This should be related to the system.
Some systems use rn to indicate retracement and line break;
Some systems use n to achieve retracement and line break;
I guess you just learned Programming, there is no need to worry about these (you may rarely use these in the future).
You can try using the gcc compiler in the command line. Mac should be configured.
If it doesn’t work, There is no need to worry. You can skip this question directly.

迷茫

Then try n and see what the effect is. By the way, what version of OS X is yours

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!