# Revised GetChar question

**URL:** <https://psychtoolbox.discourse.group/t/revised-getchar-question/1277>\
**Category:** Uncategorized\
**Created:** [January 8, 2007, 6:48pm UTC](https://psychtoolbox.discourse.group/t/revised-getchar-question/1277 "2007-01-08T18:48:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [January 8, 2007, 6:48pm UTC](https://psychtoolbox.discourse.group/t/revised-getchar-question/1277/1 "2007-01-08T18:48:52Z")

</div>

Can calling GetChar without calling FlushEvents('keyDown') cause the  
computer to freeze? That may be what was happening with my system...  
it was trying to go back to the beginning of a VERY long cue of  
keystrokes. Yeah?   
  
Also: GetString needs to be updated. Right now, the key number it is  
using for "return" is not the correct one (for my keyboard, anyway).  
I'd say just change the line  
  
case {13,3},   
  
to   
  
case {10},  
  
... but I don't know if that would work on all systems.  
  
Sorry to bug you with inanities earlier,   
  
!M

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [January 11, 2007, 8:42pm UTC](https://psychtoolbox.discourse.group/t/revised-getchar-question/1277/2 "2007-01-11T20:42:58Z")

</div>

Don't know. Works well on our PowerMac-G5. But calling the FlushEvents  
command at the beginning of your script is a good idea: As soon as  
you've called GetChar once in a session, it will record and queue all  
keypresses, including everything you'll type on the Matlab prompt or  
editor window - might by the reason for your long queue of keystrokes.  
  
GetString is already properly fixed in the developer branch, but not  
yet comitted to beta.  
  
ciao,  
-mario  
  
  
--- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "questionmarkusc" \<lescroar@...\>  
wrote:  

> \>  
> \> Can calling GetChar without calling FlushEvents('keyDown') cause the  
> \> computer to freeze? That may be what was happening with my system...  
> \> it was trying to go back to the beginning of a VERY long cue of  
> \> keystrokes. Yeah?   
> \>   
> \> Also: GetString needs to be updated. Right now, the key number it is  
> \> using for "return" is not the correct one (for my keyboard, anyway).  
> \> I'd say just change the line  
> \>   
> \> case {13,3},   
> \>   
> \> to   
> \>   
> \> case {10},  
> \>   
> \> ... but I don't know if that would work on all systems.  
> \>   
> \> Sorry to bug you with inanities earlier,   
> \>   
> \> !M  
> \>
