| www.delorie.com/archives/browse.cgi | search |
| X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f |
| From: | "A. Sinan Unur" <asu1 AT cornell DOT edu> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: getch() |
| Date: | 18 Mar 2002 00:03:19 GMT |
| Organization: | Cornell University |
| Lines: | 41 |
| Sender: | asu1 AT cornell DOT invalid (on pool-141-149-207-233.syr.east.verizon.net) |
| Message-ID: | <Xns91D4C1D5F5499asu1cornelledu@132.236.56.8> |
| References: | <003201c1cdd9$64261820$88ed5ecb AT u4v4b7> |
| NNTP-Posting-Host: | pool-141-149-207-233.syr.east.verizon.net |
| X-Trace: | news01.cit.cornell.edu 1016409799 5925 141.149.207.233 (18 Mar 2002 00:03:19 GMT) |
| X-Complaints-To: | usenet AT news01 DOT cit DOT cornell DOT edu |
| NNTP-Posting-Date: | 18 Mar 2002 00:03:19 GMT |
| User-Agent: | Xnews/L5 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
"Amish K. Munshi" <amishmunshi AT yahoo DOT com> wrote in news:003201c1cdd9
$64261820$88ed5ecb AT u4v4b7:
> Hi,
>
> I used to use getch();
> after the end of my programs in Turbo C using #include <conio.h>.
> The reason I used to do this is to halt for a input before the output
> vanishes from the screen.
> Is there an alternative to this.
>
you know, it is not a bad idea to read the documentation occasionally.
info libc func conio
does this help:
#include <conio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
srand(time(0));
while(1)
{
int i;
clrscr();
for(i = 0; i < 20; ++i)
{
gotoxy(5, i);
textcolor((rand()%6)+1);
cputs("0123456789");
}
if( getch() == 'q' )
break;
}
textmode(C80);
return 0;
}
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |