954,480 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Set font size in C program

Hi,

Is it possible to display the output of a C program in different font sizes by setting it in the code? If yes, please guide regarding the same.

Thanks.

iceman29
Newbie Poster
12 posts since Feb 2008
Reputation Points: 10
Solved Threads: 2
 

Depends, if you mean using the Win32 API, then it's easily possible. AFAIK it's not possible to set the font size on the console through just using C++ code.

William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
 

Use some graphics library.

s_sridhar
Junior Poster
141 posts since Mar 2009
Reputation Points: 17
Solved Threads: 16
 

>Use some graphics library.
There's not much point in recommending that, we first need to know some details before simply telling him to use a graphics library. If he's using the Win32 API, he can simply use CreateFont and use the returned object with the window HDC.

If he plans on doing this with a console window, then there's problems.

William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
 
Depends, if you mean using the Win32 API, then it's easily possible. AFAIK it's not possible to set the font size on the console through just using C++ code.

I am working on UNIX, and using CC to compile the code.

iceman29
Newbie Poster
12 posts since Feb 2008
Reputation Points: 10
Solved Threads: 2
 
I am working on UNIX, and using CC to compile the code.

Wouldn't it be terminal dependent? something to do with termcap settings? (Just guessing, its been 15 or so years since I worked with *nix).

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Then, i believe you can't use graphics library. Only for console applications.

s_sridhar
Junior Poster
141 posts since Mar 2009
Reputation Points: 17
Solved Threads: 16
 

its so easy!!!!

shielaborja
Newbie Poster
2 posts since Aug 2010
Reputation Points: 8
Solved Threads: 0
 
its so easy!!!!

Ok smartass if its so easy then prey tell us the answer.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 
its so easy!!!!


It's the I-know-the-answer-but-I-won't-tell syndrome.
It generally happens to people who suffer from I-don't-know-the-answer

Don't be too hard on him...

xavier666
Junior Poster
173 posts since Sep 2009
Reputation Points: 71
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You