you use buffered input. so when ischarwaiting() indicates there is data, you can use waitkey() without any problem.
like i said, inkey() will return if no data is in the buffer, but also 0 for a character 0 ! So you can not tell the difference between a 0 byte and no data waiting.
that is why you need to use ischarwaiting in combination with waitkey.
						  
                       
                           
                       
                     ↧