From 3545fe53f7bc91a0105be03e6287f6c990183d5e Mon Sep 17 00:00:00 2001 From: Brandon Turner Date: Thu, 8 Jun 2006 12:59:32 +0000 Subject: [PATCH] ReadConsole test to show how backspaces should be handled. svn path=/trunk/; revision=22282 --- rosapps/tests/directory.xml | 4 +++ rosapps/tests/readconsole/main.c | 32 ++++++++++++++++++++ rosapps/tests/readconsole/readconsole.rbuild | 5 +++ 3 files changed, 41 insertions(+) create mode 100644 rosapps/tests/readconsole/main.c create mode 100644 rosapps/tests/readconsole/readconsole.rbuild diff --git a/rosapps/tests/directory.xml b/rosapps/tests/directory.xml index 88b5ae7803e..978c27c2bdb 100644 --- a/rosapps/tests/directory.xml +++ b/rosapps/tests/directory.xml @@ -187,6 +187,10 @@ + + + + diff --git a/rosapps/tests/readconsole/main.c b/rosapps/tests/readconsole/main.c new file mode 100644 index 00000000000..2d85553707f --- /dev/null +++ b/rosapps/tests/readconsole/main.c @@ -0,0 +1,32 @@ +#include "stdio.h" +#include "Windows.h" + +int main() +{ + TCHAR Buffer = 0; + DWORD Count = 0; + + // + // We clear the mode, most importantly turn off ENABLE_ECHO_INPUT and ENABLE_LINE_INPUT + // This is the same mode as that is set up by getch() when trying to get a char + // + SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),0); + + // + // We read one char from the input and then return + // + ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&Buffer,1,&Count,NULL); + + // + // We print out this char as an int to show that infact a backspace does count as input + // + printf("You printed %c :: ", Buffer); + printf("With a value %d :: ", Buffer); + printf("Number of chars recieved %lu :: ", Count); + printf("Char equal to backspace %d \n", (Buffer == '\b')); + + // + // :) + // + return 0; +} diff --git a/rosapps/tests/readconsole/readconsole.rbuild b/rosapps/tests/readconsole/readconsole.rbuild new file mode 100644 index 00000000000..1542622213a --- /dev/null +++ b/rosapps/tests/readconsole/readconsole.rbuild @@ -0,0 +1,5 @@ + + + kernel32 + main.c +