NO

Author Topic: How to include conio.h  (Read 6316 times)

againagain

  • Guest
How to include conio.h
« on: October 11, 2011, 07:23:09 PM »
Some years ago we used a different environment and constantly called functions from the conio library. Only afterwards did I learn that it wasn't standard and that a lot of environments don't support it.

Thing is, I tried running a couple of those old programs in Pelles C, and sure enough, I get "missing prototype" errors for all of conio's functions (textbackground, getch, gotoxy...) despite having included <conio.h>, and despite conio.h being there in the PellesC\Include folder. I really don't know how to manage libraries; is there a way I could use conio?

Offline Vortex

  • Member
  • *
  • Posts: 867
    • http://www.vortex.masmcode.com
Re: How to include conio.h
« Reply #1 on: October 11, 2011, 08:12:50 PM »
Hi againagain,

The standart #include <conio.h>  statement should work. What's exactly the error message returned by Pelles C IDE?

This example is tested with Pelles C:

Code: [Select]

#include <stdio.h>
#include <conio.h>
int main(int argc,char *argv[])
{
_clrscr(); /*declared in conio.h*/
printf("Hello world!");

}
« Last Edit: October 11, 2011, 08:16:30 PM by Vortex »
Code it... That's all...

CommonTater

  • Guest
Re: How to include conio.h
« Reply #2 on: October 11, 2011, 08:15:58 PM »
You probably need to go into Project->Settings->Compiler and check "Define Compatibility Names".

All the functions in conio are non-standard so they will be prefixed by an underscore... checking the box allows the compiler to see them without the underscore.

Also #include <conio.h>

againagain

  • Guest
Re: How to include conio.h
« Reply #3 on: October 11, 2011, 11:01:35 PM »
All the functions in conio are non-standard so they will be prefixed by an underscore... checking the box allows the compiler to see them without the underscore.

That seemed to do the trick, thanks :D Didn't know about underscore for nonstandard functions.

CommonTater

  • Guest
Re: How to include conio.h
« Reply #4 on: October 12, 2011, 02:51:31 AM »
Look in the help file (that's why it's there afterall) and you will discover that every function in the library is listed and the non-standard ones are clearly identified... both with ugly purple text at the top of their pages but also with an underscore before their names. 

Of course, in an ideal world, you should not use non-standard fuctions...
(But there's nothing ideal about this world, far as I can tell  ;D )


« Last Edit: October 12, 2011, 02:53:24 AM by CommonTater »