delorie.com/archives/browse.cgi | search |
From: | "Duncan Burch" <duncanburch AT nospam DOT usa DOT net> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Help, my getch() and getchar() functions don't work properly!!! |
Date: | Sun, 27 Sep 1998 21:00:18 +0100 |
Organization: | Cable Online |
Lines: | 14 |
Message-ID: | <6um5bc$gql$1@nclient5-gui.server.ntli.net> |
References: | <360E6FE5 DOT 51F931FB AT iafrica DOT com> |
NNTP-Posting-Host: | 194.168.20.42 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
>I've been doing a tutorial on C and I have gotten to this bit where you >learn how to use the getch() and getchar() functions. The problem is >that they don't work as they should. I even tried using my TurboC++ >compiler. It works on that. But when I compile with gcc the program does >not print out any chars until a key that is being watched for is >pressed. Then it prints all of they keys pressed. What is going on??? try fflushf(stdout). This will tell djgpp to flush any output to the screen immediately. The reason you have to do this is because djgpp buffers any output going to the screen, and then writes it all at once, to make the process(which involves switching into real mode and back) more effecient.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |