I don't think this is possible with system(). You have to take a platform specific way.
On windows, see http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx
The one you need is SetCurrentConsoleFontEx.
Also, for colors you should use SetConsoleTextAttribute as it allows several different colors in different locations at the same time.
When you try changing font size, you should first get the CONSOLE_FONT_INFOEX structure with GetCurrentConsoleFontEx, change the size member and then call SetCurrentConsoleFontEx.
here's a full example. I can't say if it works, because apparently functions Get/SerCurrentConsoleFontEx are only available in windows vista and later.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <windows.h>
int main(){
HANDLE outcon = GetStdHandle(STD_OUTPUT_HANDLE);//you don't have to call this function every time
CONSOLE_FONT_INFOEX font;//CONSOLE_FONT_INFOEX is defined in some windows header
GetCurrentConsoleFontEx(outcon, false, &font);//PCONSOLE_FONT_INFOEX is the same as CONSOLE_FONT_INFOEX*
font.dwFontSize.X = 7;
font.dwFontSize.Y = 12;
SetCurrentConsoleFontEx(outcon, false, &font);
SetConsoleTextAttribute(outcon, 0x0C);
std::cout << "I'm red";
std::cin.get();
return 0;
}
yes i know there are easier ways to do it with an app but i want a command line based prog atm :)
If it is possible i see no reason not to do so in this case as although it uses these calls in a roundabout way and uses alot more processing, the simple fact of the matter is in this program its not big enough to make a difference to be honest and i simply wish to learn :)