delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/22/17:14:56

From: "Florent BUDILLON" <florent AT oih DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: rectification about switch ... such a big mistake
Date: Tue, 22 Feb 2000 22:47:10 +0100
Organization: Aachen University of Technology (RWTH)
Lines: 48
Message-ID: <88v09h$64n$1@nets3.rz.RWTH-Aachen.DE>
NNTP-Posting-Host: pupulse.oih.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 951256177 6295 137.226.149.42 (22 Feb 2000 21:49:37 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 22 Feb 2000 21:49:37 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

Sorry but in the first message there is a big mistake. I didn't to write all
the program because it's quite long. So if somebody want to help me, I made
it right.

I wrote this function which works quite well except one thing, the second
time I use the function the program writes twice "Absolute (enter M) or
relative (enter A) displacement" 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') . 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()

......

Node->Type=input_one_char("Absolute (enter M) or relative (enter A)
displacement");

.....



- Raw text -


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