Define - is stdin empty

Started by vedro-compota, October 20, 2011, 04:00:10 PM

Previous topic - Next topic

vedro-compota

#15
last attempt - concrect problem is here  = http://fkn.ktu10.com/?q=node/150 (it's just collection of moments which we've discussed with  specific wording of the problem)

CommonTater , I totally agree with your advices about way of programming stading and i also "just get it" about scanf() and other - big thanks for this - especially for s standard pdf))
i'm really try to understand problems which may be not important  in current situation  - and mau be it isn't right or isn't good.

( scanf(" %c", ch) - will shut program down after few seconds of working  - compiler 'll show warning that the "ch" variable isn't in use - I don't understand  why it's so - but that's "other thread" as I understand )

i'm just want to understand as much as possible about with which i deal) The c standart will really help me with this = you've really helped me with this - big thanks)

CommonTater

#16

int mainmenu(void)
  {   
     int ch;     
     char* mtext = " Please specify the number of the task. \n * You can choose on number from set = {1} \n * Specify \"0\" to exit\n" ;
    char* errmes = " Error(!) = Main menu does not support this command.\n Make sure that your task number is from menu set of commands and try again. " ;       

     printf("\n%s",mtext );     
     ch = getchar() ;
     while (getchar() != '\n');

     switch(ch)   
        {
           case '0':   
               printf("\nyou choise is item 0 \n" );
               break;
           case '1':
               printf("\nyou choise is item 1 \n" );
               break;       
           default:
              printf("\nInvalid choice\n");   
         }   
      return 0; 
}


Quote
scanf(" %c", ch) - will shut program down after few seconds of working  - compiler 'll show warning that the "ch" variable isn't in use - I don't understand  why it's so - but that's "other thread" as I understand

scanf (" %c", &ch);



vedro-compota