delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/22/16:15:34

From: "Florent BUDILLON" <florent AT oih DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: switch ...
Date: Tue, 22 Feb 2000 21:41:26 +0100
Organization: Aachen University of Technology (RWTH)
Lines: 43
Message-ID: <88usea$4fg$1@nets3.rz.RWTH-Aachen.DE>
NNTP-Posting-Host: pupulse.oih.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 951252234 4592 137.226.149.42 (22 Feb 2000 20:43:54 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 22 Feb 2000 20:43:54 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,
I wrote this function which works quite well except one thing, the second
time I use the function the program writes twice "Enter the step code you
want to remove :" without doing really something wrong but it looks bad on
the screen. The defect comes from the switch, and in fact it's when the
character is 'M' only (not with 'A') that the program ask twice the step to
remove. Do you know if there any bug with this "switch" or I did it wrong.

Thanks for helping me ...

int input_one_char(char CHAINEcharact[])

{
 int test=0,check=0;
 char charact;

 do
   {
    printf("\r%s : ",CHAINEcharact);
    fflush(stdout);
    test=scanf("%c*[^\n]",&charact);
    charact=toupper(charact);
    switch (charact)
           {
            case 'A':
            case 'M':
                 check=1;
           };
    } while ((test!=1)||(check==0));

 return charact;

int main()

......
Stepcode=input_one_int("Enter the stepcode you want to
remove",MAXint,MINint);

.....




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019