How do I pass a user input color to the textcolor()
function in conio.h
?
textcolor(BLUE);
cprintf("Hello");
works fine, but
char c[20];
gets(c);
textcolor(c);
cprintf("Hello");
throws an error. I didn't expect it to work myself. So the question is, how can a user enter a color for text to be displayed?
Due to some stupid constrains, I have to do this on the old turbo c++ and cannot use graphics.h
, dos.h
etc. So a solution that uses textcolor()
itself would be great.