From: troy silvey (tbsilvey_at_juno.com)
Date: 2001-03-05 04:47:08
Following your conio.h advice Ullrich, I came up with this bit of code for entering user data.... int usernumber(void) // get user input 0-9999 { char temp[1], get=0, store[4]; // temp char used to echo user input int pickit; // user value returned while (get<4) { store[get]=cgetc(); // get chars until "return" or 4 digits if(store[get]=='\n') get=4; if(isdigit(store[get])) { *temp=store[get]; // temp store the digit printf("%d", atoi(temp)); // "poke" it to the screen get++; } } return((pickit=atoi(store))); } It takes in a string ignoring non-numerics, converts then returns an int from 0-9999. It also echos the input to the current cursor position so you see what your typing. Working great so far, and I can modify it to enter any thing I like. Thanks Uz and Marc for the help. troy ________________________________________________________________ GET INTERNET ACCESS FROM JUNO! Juno offers FREE or PREMIUM Internet access for less! Join Juno today! For your FREE software, visit: http://dl.www.juno.com/get/tagj. ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:39 CET