From: "Tim" Newsgroups: comp.os.msdos.djgpp Subject: Re: does kbhit() works outside ??? Date: Sat, 15 Mar 2003 09:23:39 +0000 (UTC) Organization: BT Openworld Lines: 92 Message-ID: References: NNTP-Posting-Host: host217-39-45-113.in-addr.btopenworld.com X-Trace: venus.btinternet.com 1047720219 17624 217.39.45.113 (15 Mar 2003 09:23:39 GMT) X-Complaints-To: news-complaints AT lists DOT btinternet DOT com NNTP-Posting-Date: Sat, 15 Mar 2003 09:23:39 +0000 (UTC) X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MSMail-Priority: Normal X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Helen The function kbhit() is not stored in pc.h header file, that is just where its prototype is located. The function itself is in one of the djgpp libraries which automatically gets linked into your project when you compile. A prototype is just used to tell the compiler what parameters are needed in order to call to a function that is not part current source file*. If no prototype is available the compiler will just assume that the function will accept and return integers and build the code accordingly. If you set the compiler directive -Wmissing-prototypes it would have warned you that you had no prototype for the kbhit() function. Headers also include macros and constants that are related to the various functions the it represents. kbhit() is such a simple function that you were able to use it with out any problems, but if you had tied to use something like settime() without the header file you would have found that the compiler would not be able to compile because it would not have any information about the required data structure associated with that function. I hope this helps a little, * This is by no means a complete explanation and a read of a 'C' programming guide should fill in the gaps. Tim "helen" wrote in message news:ea10a10d62eaa7aea05133d2c5488823 DOT 113557 AT mygate DOT mailgate DOT org... > > I have DJGPP on win98 and win2k > > if I write the following: > > ---- > #include > /* DO-WHILE */ > int main() > { > int x=0; > > do { > x=x+1; > printf("%5d",x); > rest(100); > } while (!kbhit()); > > return 0; > } > ---- > > I wouldn't expect it to work (isn't kbhit() defined in ?) > but IT WORKS INSTEAD ! > > also if I add > #include > > it also works and I do not need to use > _conio_kbhit() > > other functions defined in conio.h also work, even if I don't include > the conio.h !! > Like: > clrscr(), or textcolor(); and also rest(); > > how do you explain that ? > > > helen (for once it works MORE than I need it to!!) > > > -- > Posted via Mailgate.ORG Server - http://www.Mailgate.ORG