| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: C Set ++ |
* In a message originally to Julien Pierre, Bill Patterson writes: JP> Hi ! JP> JP> On Sep 28 15:30 95, Bill Patterson of 1:374/2528 wrote: JP> JP> BP> help! JP> JP> BP> I'm getting really REALLY frustrated with C Set ++. I need JP> BP> to detect a keypress, but none of the input routines will JP> BP> return untill a character and a return is entered. I JP> BP> currently need to detect a carriage return by itself, but JP> BP> will need to detect any key in the future for a "hotkeys" JP> BP> effect. I've tried everything including JP> cin >>> setf(ios::unitbuf); JP> BP> setbuf(stdin, NULL); JP> JP> BP> And more. Nothing will make cin.get() or getchar() or JP> BP> anything return to my code until a character and a return JP> BP> is entered. Help! I'm ready to through this damn compiler JP> BP> out the window! JP> JP> Use the _kbhit() function. It's described in the C Library Reference. JP> IMNSHO, you'll need to be a bit more patient than that if you want to JP> success in programming. JP> JP> Julien JP> JP> --- Msgedsq/2 2.2e JP> (2:320/215) 4 weeks and 500 compilations later isn't enough patience? Thanks though. _kbhit would do what I want. I found that one of my problems was I was calling ipfx(0) to force the output to draw on the screen. I didn't realize that it was caching a keypress as well. After getting rid of that, things worked a little better. I found that fflush(NULL) flushes both in and output buffers which is exactly what I wanted. Having residual chars in the input is what started me down this path to begin with. Thanks again! Bill --- LoraBBS-OS/2 v2.40+JP> * Origin: ChaOS/2 - The Team OS/2 BBS France - +33-1-30472772 * Origin: Planet X * Warp Co-Ordinates: 407-799-0975 (1:374/2528.0) SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 374/2528 1 3615/50 396/1 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.