examples/gpio.c: fix getchar() not working in ssh term
authorBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 10 Feb 2015 15:50:59 +0000 (15:50 +0000)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 10 Feb 2015 15:50:59 +0000 (15:50 +0000)
This is obviously not a nice way to do input handling but it avoids having more
code in the samples than is really needed

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
examples/gpio.c

index b4cab15..7d7ef70 100644 (file)
@@ -174,7 +174,7 @@ main(int argc, char **argv)
                 if (gpio_isr_start(&gpio_info) == MRAA_SUCCESS) {
                     fprintf(stdout, "Monitoring level changes to pin %d. Press RETURN to exit.\n", pin);
                     gpio_isr_handler(&gpio_info);
-                    getchar();
+                    while (getchar() != '\n');
                     gpio_isr_stop(&gpio_info);
                 }
                 else