如何在c程序中将文本加粗
如何将 PrintF 加粗? ..(我是C语言新手)
#include <stdio.h>
int main() {
int i;
for (i=1; i<=5; i++) {
printf("Md.Mehedi hasan");
}
return 0;
}
How do I Bold my PrintF? .. ( I am new in C)
#include <stdio.h>
int main() {
int i;
for (i=1; i<=5; i++) {
printf("Md.Mehedi hasan");
}
return 0;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Linux Ubuntu 18.04 的终端中进行了测试。
为了使其更具可读性,请使用一些字符串文字宏来表示颜色和格式代码,如下所示:
构建并运行 cmd:
这里有更多示例来自我的一些 bash 代码: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/useful_scripts/git-diffn.sh#L126-L138:
您可以替换
\033
(八进制 < code>33) 与\e
,因为它们的含义相同,只是表示形式不同。请参阅:https://en.wikipedia.org/wiki/ASCII#Control_code_chart。有关更多颜色和格式数字代码,请参阅此处的表:https:/ /en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
您可以通过使用分隔符来使用多个格式数字分号 (
;
),如下面的示例所示。C 语言中的一些非常酷的示例:
进一步
参考文献
ffmpeg -i in.mp4 out.gif
转换为 .gif,根据我的评论。Tested in the terminal in Linux Ubuntu 18.04.
To make that a little more readable, use some string literal macros for the color and formatting codes, like this:
Build and run cmd:
Here are a bunch more examples from some bash code of mine: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/useful_scripts/git-diffn.sh#L126-L138:
You can replace
\033
(octal33
) with\e
, as they mean the same thing just in different representations. See: https://en.wikipedia.org/wiki/ASCII#Control_code_chart.For a bunch more color and formatting number codes, see this table here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters
You can use multiple formatting numbers by separating them with a semicolon (
;
), as shown in the examples below.A couple more really cool examples in C:
Going further
References
ffmpeg -i in.mp4 out.gif
, per my comment here.如果您的终端支持 ANSI 转义序列,您可以执行以下操作:
\e
是 ESC 字符(ASCII 27 或 0x1B),ESC [ 1 m
设置粗体,并且ESC [ m
重置显示属性,即重置粗体。If your terminal supports ANSI Escape Sequences, you can do this:
The
\e
is the ESC character (ASCII 27 or 0x1B), andESC [ 1 m
sets bold, andESC [ m
resets the display attributes, which resets bold.