{"action":"closed","issue":{"url":"https://api.github.com/repos/pamolloy/pong/issues/1","labels_url":"https://api.github.com/repos/pamolloy/pong/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/pamolloy/pong/issues/1/comments","events_url":"https://api.github.com/repos/pamolloy/pong/issues/1/events","html_url":"https://github.com/pamolloy/pong/issues/1","id":105107555,"number":1,"title":"Application exits immediately without warning","user":{"login":"pamolloy","id":996930,"avatar_url":"https://avatars.githubusercontent.com/u/996930?v=3","gravatar_id":"","url":"https://api.github.com/users/pamolloy","html_url":"https://github.com/pamolloy","followers_url":"https://api.github.com/users/pamolloy/followers","following_url":"https://api.github.com/users/pamolloy/following{/other_user}","gists_url":"https://api.github.com/users/pamolloy/gists{/gist_id}","starred_url":"https://api.github.com/users/pamolloy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pamolloy/subscriptions","organizations_url":"https://api.github.com/users/pamolloy/orgs","repos_url":"https://api.github.com/users/pamolloy/repos","events_url":"https://api.github.com/users/pamolloy/events{/privacy}","received_events_url":"https://api.github.com/users/pamolloy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pamolloy/pong/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-06T18:12:40Z","updated_at":"2015-09-07T14:19:15Z","closed_at":"2015-09-07T14:19:15Z","body":"Running the binary causes the application to exit immediately. It turns out that `wgetch()` is returning a lot of errors (i.e. `ERR` which equals `-1`). When I hold down an arrow key it will return `-1` 4 times for every time it returns `258`.\r\n\r\nThe following snippet includes extra debugging code that writes the character code and errno value to a file named `debug.tmp` with every iteration.\r\n``` c\r\n    FILE *f = fopen(\"debug.tmp\", \"a\");                                          \r\n    int c;                                                                      \r\n    while( (c = wgetch(table)) != 'Q' ) {                                       \r\n        fprintf(f, \"Character code: %i\\n\", c);                                  \r\n        if (c == ERR && errno != EINTR) {                                       \r\n            fprintf(f, \"Error numer: %i\\n\", errno);                             \r\n            break;    //TODO This is a real error                             \r\n        }\r\n```\r\nIt is possible to get around this issue by commenting out the `break` statement."}}