| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Prob with user input |
I am currently working on a small program which involves the user entering
a number which will be used in a small mathematical calculation. However, I
do
NOT want the user to be able to type a letter or punctuation character. Such
characters should be ingnored and not echoed to the screen.
The problem is that I am unable to make this work. In simple terms:
1. User enters digits until (Enter) key is pressed.
2. If letter or punctuation, ignore, supress, wait for another digit.
3. If digit, echo to screen and store in a variable.
4. When (Enter) pressed, perform calculation on integer variable.
I have been trying to do this using a combination of loops and getch() (plus
variant) functions, but to no avail. Does anyone have any ideas? I know this
seems like a simple, mundane task, but I haven't touched C fr a while, and I
am a tad hazy with C at the moment. Any help would be appreciated.
Note: no code snippet because I changed it umpteen times before deleting it!
Johnno (japp{at}mpx.com.au)
... Joystick: Peripheral used by consulting adults.
--- GoldED 2.50 UNREG
* Origin: Lateline BBS, Sydney; +61-2-579-6564; 24 hours; V.FC (3:712/841)SEEN-BY: 50/99 78/0 620/243 623/630 711/401 409 410 413 430 808 809 932 934 SEEN-BY: 712/311 407 411 505 506 515 517 535 617 624 704 813 816 820 824 828 SEEN-BY: 712/841 852 713/888 714/906 800/1 7877/2809 @PATH: 712/841 624 517 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™.