NO

Author Topic: Simple console mode menu handling  (Read 16814 times)

vedro-compota

  • Guest
Re: Simple console mode menu handling
« Reply #15 on: October 21, 2011, 05:41:47 PM »
mmmm....i need clean input before getting the menu command so the code'll be =
Code: [Select]
while (getchar() != '\n');
 printf("\n%s",mtext );
   ch = getchar();

CommonTater

  • Guest
Re: Simple console mode menu handling
« Reply #16 on: October 21, 2011, 05:46:06 PM »
You can do that... or you can do this...
Code: [Select]
printf("\n%s",mtext);
scanf(" %c", &ch);

Note the leading space between the " and % in the scanf() ... that tells it to ignore invisible characters (Enter, Tab, spaces, etc) hanging around in the buffer.



vedro-compota

  • Guest
Re: Simple console mode menu handling
« Reply #17 on: October 21, 2011, 06:13:24 PM »
hm. the while (getchar() != '\n'); will stop program if the buffer is empty scanf() can get visible symbol from previous line which was put into input and hadn't been read at the whole - is there any way to check - is the buffer empty before call something which can make it so = http://forum.pellesc.de/index.php?topic=4052.0

vedro-compota

  • Guest
Re: Simple console mode menu handling
« Reply #18 on: October 21, 2011, 06:20:07 PM »
CommonTater , in your previous post you've posted a link to book -is this c specification?

CommonTater

  • Guest
Re: Simple console mode menu handling
« Reply #19 on: October 21, 2011, 06:29:48 PM »
CommonTater , in your previous post you've posted a link to book -is this c specification?

That is the current standard for C programming.


EdPellesC99

  • Guest
Re: Simple console mode menu handling
« Reply #20 on: December 29, 2011, 01:00:12 AM »
There seems to be a problem with downloading the attachment here, and for Timo's thread.

!! Maybe site work is in progress.... Ed

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Simple console mode menu handling
« Reply #21 on: December 29, 2011, 03:29:42 AM »
There seems to be a problem with downloading the attachment here, and for Timo's thread.

!! Maybe site work is in progress.... Ed
Could be. Saw this happen in the tinyPDF thread to me yesterday, but all links that I tried today, just now, are working fine....

Ralf