c - 如何忽略 '\40' 表达式并只输出单元格文本

标签 c arrays string pointers formatting

所以我总是使用 figlet {text} 为我的程序生成框文本,但是这次 ~ 我的 C 编译器决定采取行动。如何忽略此文本数组的\40:

static char *header =
"  _   _      _                      _      _____          _              \n"
" | \ | | ___| |___      _____  _ __| | __ |_   _| __ ___ (_) __ _ _ __   \n"
" |  \| |/ _ \ __\ \ /\ / / _ \| '__| |/ /   | || '__/ _ \| |/ _` | '_ \  \n"
" | |\  |  __/ |_ \ V  V / (_) | |  |   <    | || | | (_) | | (_| | | | | \n"
" |_| \_|\___|\__| \_/\_/ \___/|_|  |_|\_\   |_||_|  \____/ |\__,_|_| |_| \n"
"                                                       |__/              \n";

我怎样才能正确编译它?

最佳答案

enter image description here

转义所有反斜杠:

static const char header[] =
"  _   _      _                      _      _____          _              \n"
" | \\ | | ___| |___      _____  _ __| | __ |_   _| __ ___ (_) __ _ _ __   \n"
" |  \\| |/ _ \\ __\\ \\ /\\ / / _ \\| '__| |/ /   | || '__/ _ \\| |/ _` | '_ \\  \n"
" | |\\  |  __/ |_ \\ V  V / (_) | |  |   <    | || | | (_) | | (_| | | | | \n"
" |_| \\_|\\___|\\__| \\_/\\_/ \\___/|_|  |_|\\_\\   |_||_|  \\____/ |\\__,_|_| |_| \n"
"                                                       |__/              \n";

这在源代码中看起来很奇怪,但可以正常打印。

关于c - 如何忽略 '\40' 表达式并只输出单元格文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19391363/

相关文章:

c++ - 在字符串中使用删除函数是否会使迭代器无效

c - 在运行时从 argv[1] 中的字符生成字符串

c - 收到错误 : expected identifier or '(' before '{' token

arrays - 从 Ruby 中的列表中获取对的所有组合

c - 如何使用 c 获取使用 dd 命令创建的文件的大小

Java 数组 : how to ensure the semantic correctness of indexes used?

JavaScript/jQuery : Array - For In Loop Return Value of Lowest Key

javascript - 在每次出现特定子字符串时剪切数组中存在的 JS 字符串并附加到同一数组

C 程序在 .txt 文件中看不到最后一个字母

c - x86_64 汇编约定保存参数寄存器