How to change font size in console application using C

Although teppic's answer to use system() will work, it is rather intensively heavy-handed to call an external program just to do that. As for David RF' answer, it is hard-coded for a specific type of terminal (probably a VT100-compatible terminal type) and won't support the user's actual terminal type.

In C, you should use terminfo capabilities directly:

#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);

Still, as teppic notes, there is no support for changing the font size. That's under the user's control.

Tags:

C