delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/08/16:11:00

From: "Florent BUDILLON" <florent AT oih DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: help !!!!!
Date: Wed, 8 Mar 2000 21:00:44 +0100
Organization: Aachen University of Technology (RWTH)
Lines: 30
Message-ID: <8a6bi7$n9i$1@nets3.rz.RWTH-Aachen.DE>
NNTP-Posting-Host: pupulse.oih.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 952545671 23858 137.226.149.42 (8 Mar 2000 20:01:11 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 8 Mar 2000 20:01:11 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 :

int input_one_int(char CHAINEval[],int MAXval,int MINval)// Rmq: Bug if char
entered
{

 int test=0,check=0,value;

 do
   {
    printf("\r%s : ",CHAINEval);
    fflush(stdout);
    fflush(stdin);
    test=scanf("%d*[^\n]",&value);
    if (test==EOF)
       {
       printf("syntax error");
       }
    if ((value<=MAXval)&&(value>=MINval)) check=1;
    } while ((test!=1)||(check==0));

 return value;
}

and in fact I wanted to erase the case when I enter a character instead of
an integer, but it doesn't work !
any idea,
thank you in advance.


- Raw text -


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