www.delorie.com/archives/browse.cgi | search |
From: | Endlisnis <s257m AT unb DOT ca> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: getch() getche() |
Date: | Mon, 24 Aug 1998 11:35:59 -0300 |
Organization: | NBTel Internet |
Lines: | 35 |
Message-ID: | <35E17A4F.1B0B923C@unb.ca> |
References: | <01bdcdf6$1f096440$LocalHost AT alf DOT uib DOT no> <35e03b3e DOT 0 AT newsread1 DOT dircon DOT co DOT uk> <01bdcec2$4bfa15e0$LocalHost AT alf DOT uib DOT no> |
NNTP-Posting-Host: | fctnts05c88.nbnet.nb.ca |
Mime-Version: | 1.0 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
LJ wrote: > I've tried with and without conio.h, and the results is not what I > expected. Maybe I've have totally misunderstood what these functions > (getch( ) getche( )) can do for me... . > Please try these little program (and of cause if you've not already have > tried other more advanced programs) and see what results you get. The line > in 'cout' don't show before I press a character. Try this. It didn't work because cout is line-buffered. It doesn't write to the screen until it reaches an end-of-line character. > #include <iostream.h> > #include <conio.h> > > main() > { > char Ch; > cout << "Write a character: \n"; > Ch = getch(); > cout << endl << "You wrote: " << Ch << endl; > > cout << "Write a new character: \n"; > Ch = getche(); > cout << endl << "You wrote: " << Ch << endl; > } -- (\/) Endlisnis (\/) s257m AT unb DOT ca Endlisnis AT GeoCities DOT com Endlis AT nbnet DOT nb DOT ca
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |