How can I change the text and background colors in C++? I usedfor the color change and it works. The only problem is, how can I tell what the different colors are? for example "color 02" and "color 56"?Code:system("color 02")
How can I change the text and background colors in C++? I usedfor the color change and it works. The only problem is, how can I tell what the different colors are? for example "color 02" and "color 56"?Code:system("color 02")
That's OS specific. For Windows, you'd want to use something like SetConsoleTextAttribute() which is defined in <windows.h>. You can find about all that here.
For Linux, I don't really know. You might have to use a library like ncurses or something.
Sent from my iPadŽ
In too many ways, depending on your operating system. One of the most portable ways is to get PDCurses. Its documentation is here. You are looking for the attr functions and possibly the color functions depending on what you want to do.
If you are not concerned with portability and you are programming for windows only, take a look at console.h.
If the same as above, but you are developing for linux only, you can also use PDCurses which is nothing more than NCurses made portable.
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
Remember if you use sly's idea, you would have to write the function first, for an idea, if you have MSVC++ ( any version ) check the help files, they might give you the function. Else, try a google
This comes up a lot. Here's one I prepared earlier - http://cboard.cprogramming.com/showp...05&postcount=7