如何解决C语言中光标相关的\b、\r
我使用的是 Visual Studio 社区 2019,并在 Window 10 中使用 C 语言。
我理解 \b 和 \r 的用法。
他们移动光标而不删除任何文本。
例如)
#include <stdio.h>
int main(void) {
printf("abcd\r");
}
它打印 [ bcd]
我不明白为什么会发生这种现象。
解决方法
这很有趣,老实说我以前从未见过:但是我在尝试学习如何使用简单的 Win32 应用程序将文本输出到静态控件时遇到了这个问题。我把它作为我自己参考的样本,但也许它会帮助你?
空白问题似乎变得越来越重要,特别是如果您深入研究 CMAKE 文件(与制作程序的编译器文件有关)。
声明为 LPCWSTR 类型的变量名,如果您需要,这不是一个完整的最小程序,我可以分享.. ?? LPCWSTR StaticName_Extra(LPCWSTR) {
const wchar_t* Anicdotes = L"Basically using this format\n\
I can write anything i want as long as i want (?)\n\
and just keep going respectively.\n\
A New Line requires 2 new line marks... \n\
While more is good \n\
using the 'backslash n backslash' to end any line it is also very important to \n\
make sure the code denotes this with a 'backslash n backslash' directly \n\
after the last line of text via wchar_t* variable content\n\
white space is imperative to take into account lol \n\
So how do i add this as a wchar_t statement in this text format! well - \\n\\ \n\
\r\
\r\
\\r\\ then there is carriage return done \n\
\r\
\r\
\t\ \t\ \t\ \t\ \t\ \t\ \\t\\Tab marker! \n\
\n\
";
return (LPCWSTR)Anicdotes;
}
当我受到限制时,尝试使用不同的方式输出文本很有趣。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。