How to add conio in Codeblocks?

Ramisa Anjum Aditi picture Ramisa Anjum Aditi · May 22, 2016 · Viewed 12.1k times · Source

I'm trying to build and run this code

#include<stdio.h>
#include<conio.h>

main()
{
textcolor(RED); 
cprintf("Hello, World!");

getch();
return 0;
}

I use code blocks - gcc compiler.As GCC doesn't support conio.h , i'm getting a lot of errors.I want to add a library which is needed for running this kind of programs. Being instructed by a blog I downloaded conio21 from this link: https://sourceforge.net/projects/conio/ but I can't find the libconio.a there.Can you please explain how to add the library?

Answer

Prashant Kumar picture Prashant Kumar · May 22, 2016

Functions like textcolor used to work in old compilers, you can't use them in new compilers like GNU GCC used by Code::Blocks.

To see how to change textcolor, this link might be able to help you:

How to change text color and console color in code::blocks?