Please help me.
Can you guys tell me how to put a background color in C.

Recommended Answers

All 2 Replies

If you OS is Windows, you can use the Windows API for it, but you can also use the conio.h include file features, in DOS or Windows, up to the 16 bit code limit. (That is, the 64 bit versions of Windows won't run Turbo C code, without an added emulator that is not standard). I have Windows 7 64 bit, and can't run any Turbo C 16 bit code.

This is a good reason imo, to switch from Turbo C to Pelles C (also free), or one of the other good free C compilers. While most of your Turbo C programs can be recompiled quite easily, (including conio.h code with Pelles C or any compiler that supports that include file), anything special (like your graphics), will be unable to re-compile as is.

Look up the functions in conio.h, in your help file list, and you'll find what you need for the conio.h way. It's right in your help file.

If you want to use the Windows API, check out this post:

using the functions textbackground(int) and setbkcolor(int) ..
textbackground(int) prototype is in the header file conio.h and setbkcolor(int) prototype is in the header file graphics.h and

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.