Project with external library
In this section we'll develop an app with an external library. External libraries are used in almost every project written in any language. They allow code reuse resulting faster project cycle. We'll learn how to configure an external library with a Code::Blocks project.
We have printed Hello World!
text to console. How about printing text in color? We can use a library called conio2
(http://conio.sourceforge.net/) to print text in color and do other text manipulations. A compiled copy of conio2
library is provided together with the book. Consider the following example code:
#include <cstring> #include "conio2.h" int main() { int screenWidth = 0; const char* msg = "Hello World!\n\n"; struct text_info textInfo; inittextinfo(); gettextinfo(&textInfo); screenWidth = textInfo.screenwidth; textcolor(YELLOW); textbackground(RED); cputsxy( (screenWidth - strlen(msg))/2 , textInfo.cury, const_cast<char*>(msg) ); ...