How to compile c code with conio.h,dos.h,io.h header files in codeblock,Windows (beginner)?

6.8k views Asked by At

I've started practicing C programming recently and I've searched online for some codes so I can see how they work.I found one with these 3 header files (conio.h,dos.h,io.h) included.

I use Codeblocks 12.11 on Windows 8.0 .I am a beginner not only in C language,but generally in programming.(Seen some PASCAL before,cause i heard it was easy).

Please help!

2

There are 2 answers

1
Michael On

Look into the documentation for Code::Blocks [1]. conio.h + dos.h are incredibly old and outdated. The C compiler you install/have installed should include much more useful functions to do console I/O, such as stdio.h, which has printf etc contained in it.

[1] - http://www.cprogramming.com/code_blocks/

0
rpd On

AFAIK conio.h is a Borland (now Embarcadero) header file (ie a non standard header file specific to Borland bcc32 & TurboC C compilers).

I can't remember what functions it has, except for clrscr() but I do know it is widely present in C code snippets on the internet. It seems to be a favourite from Indian programmers who may even still be taught programming with the old outdated TurboC program. It is best to avoid using these non standard headers and find the equivalent functions in standard ISO C headers or write your own functions! I have also found it can be a pain trying to use code with theses headers!

There are other Borland headers often used eg graphics.h and finding equivalent graphic functions I have found tricky too!

I think an equivalent to conio.h and clear screen for GCC Compiler is to use stdlib.h and system("cls");

Hope this helps...goodluck!