Click here to Skip to main content
15,921,279 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSaving a list box or list control data to txt file Pin
shinyhui3-Apr-05 23:33
shinyhui3-Apr-05 23:33 
GeneralRe: Saving a list box or list control data to txt file Pin
toxcct3-Apr-05 23:53
toxcct3-Apr-05 23:53 
GeneralRe: Saving a list box or list control data to txt file Pin
RobJones4-Apr-05 5:44
RobJones4-Apr-05 5:44 
GeneralRe: Saving a list box or list control data to txt file Pin
shinyhui4-Apr-05 14:17
shinyhui4-Apr-05 14:17 
GeneralTELNET FAILURE!!! URGENT HELP NEEDED!!! Pin
URagavSouth3-Apr-05 23:32
URagavSouth3-Apr-05 23:32 
Generalvalidation Pin
mpapeo3-Apr-05 23:14
mpapeo3-Apr-05 23:14 
GeneralRe: validation Pin
Gary R. Wheeler4-Apr-05 1:57
Gary R. Wheeler4-Apr-05 1:57 
GeneralRe: validation Pin
David Crow4-Apr-05 2:55
David Crow4-Apr-05 2:55 
mpapeo wrote:
printf("\nEnter choice (1-4): ");
scanf("%d", &choice);
return choice;


How about some error checking:

int done = 0;
while (! done)
{
    printf("\nEnter choice (1-4): ");
    done = scanf("%d", &choice);
}
return choice;
This is hardly foolproof, and may not even work, but it might give you a foundation to build upon. An alternative is to use getch() to get each character as it is typed. If it is a numeric character, proceed. Otherwise, indicate problem and ask for another character.


"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow


GeneralRe: validation Pin
mpapeo4-Apr-05 7:51
mpapeo4-Apr-05 7:51 
GeneralRe: validation Pin
mpapeo4-Apr-05 10:30
mpapeo4-Apr-05 10:30 
GeneralRe: validation Pin
David Crow4-Apr-05 10:38
David Crow4-Apr-05 10:38 
GeneralRe: validation Pin
mpapeo4-Apr-05 11:01
mpapeo4-Apr-05 11:01 
GeneralRe: validation Pin
mpapeo4-Apr-05 12:01
mpapeo4-Apr-05 12:01 
GeneralRe: validation Pin
David Crow4-Apr-05 17:03
David Crow4-Apr-05 17:03 
GeneralRe: validation Pin
David Crow4-Apr-05 17:01
David Crow4-Apr-05 17:01 
Generalglobal variables in dynamic link library Pin
arthi_mclt3-Apr-05 23:05
arthi_mclt3-Apr-05 23:05 
GeneralRe: global variables in dynamic link library Pin
Alexander M.,4-Apr-05 2:53
Alexander M.,4-Apr-05 2:53 
GeneralText display with CHtmlView Pin
lordguid3-Apr-05 22:48
lordguid3-Apr-05 22:48 
GeneralRichEdit and Console Pin
AdyOS3-Apr-05 22:36
AdyOS3-Apr-05 22:36 
GeneralRe: RichEdit and Console Pin
toxcct3-Apr-05 22:39
toxcct3-Apr-05 22:39 
GeneralRe: RichEdit and Console Pin
AdyOS3-Apr-05 23:00
AdyOS3-Apr-05 23:00 
GeneralRe: RichEdit and Console Pin
toxcct3-Apr-05 23:22
toxcct3-Apr-05 23:22 
GeneralRe: RichEdit and Console Pin
S. Senthil Kumar3-Apr-05 23:24
S. Senthil Kumar3-Apr-05 23:24 
GeneralRe: RichEdit and Console Pin
AdyOS3-Apr-05 23:33
AdyOS3-Apr-05 23:33 
GeneralRe: RichEdit and Console Pin
AdyOS3-Apr-05 23:58
AdyOS3-Apr-05 23:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.