如何使用C更改控制台应用程序中的字体大小

Gua*_*ian 6 c

如何使用c更改打印字体的字体大小?

 printf ("%c", map[x][y]);
Run Code Online (Sandbox Code Playgroud)

我想打印一个大于程序中所有其他文本的数组.有没有办法让这个声明更大?

Cel*_*ada 5

尽管teppic 的使用答案system()会起作用,但调用外部程序只是为了做到这一点是相当繁重的。至于David RF 的回答,它是针对特定类型的终端(可能是兼容 VT100 的终端类型)进行硬编码的,并且不支持用户的实际终端类型。

在 C 中,您应该直接使用 terminfo 功能:

#include <term.h>

/* One-time initialization near the beginning of your program */
setupterm(NULL, STDOUT_FILENO, NULL);

/* Enter bold mode */
putp(enter_bold_mode);

printf("I am bold\n");

/* Turn it off! */
putp(exit_attribute_mode);
Run Code Online (Sandbox Code Playgroud)

尽管如此,正如teppic 所指出的,不支持更改字体大小。这在用户的控制之下。