[ros-diffs] [turner] 22282: ReadConsole test to show how backspaces should be handled.

turner at svn.reactos.org turner at svn.reactos.org
Thu Jun 8 14:59:33 CEST 2006


Author: turner
Date: Thu Jun  8 16:59:32 2006
New Revision: 22282

URL: http://svn.reactos.ru/svn/reactos?rev=22282&view=rev
Log:
ReadConsole test to show how backspaces should be handled.

Added:
    trunk/rosapps/tests/readconsole/
    trunk/rosapps/tests/readconsole/main.c
    trunk/rosapps/tests/readconsole/readconsole.rbuild
Modified:
    trunk/rosapps/tests/directory.xml

Modified: trunk/rosapps/tests/directory.xml
URL: http://svn.reactos.ru/svn/reactos/trunk/rosapps/tests/directory.xml?rev=22282&r1=22281&r2=22282&view=diff
==============================================================================
--- trunk/rosapps/tests/directory.xml (original)
+++ trunk/rosapps/tests/directory.xml Thu Jun  8 16:59:32 2006
@@ -187,6 +187,10 @@
 	<xi:include href="p_dup_handle/p_dup_handle.xml" />
 </directory>
 
+<directory name="readconsole">
+	<xi:include href="readconsole/readconsole.rbuild" />
+</directory>
+
 <!-- fixme: regdump -->
 
 <directory name="regqueryvalue">

Added: trunk/rosapps/tests/readconsole/main.c
URL: http://svn.reactos.ru/svn/reactos/trunk/rosapps/tests/readconsole/main.c?rev=22282&view=auto
==============================================================================
--- trunk/rosapps/tests/readconsole/main.c (added)
+++ trunk/rosapps/tests/readconsole/main.c Thu Jun  8 16:59:32 2006
@@ -1,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;
+}

Added: trunk/rosapps/tests/readconsole/readconsole.rbuild
URL: http://svn.reactos.ru/svn/reactos/trunk/rosapps/tests/readconsole/readconsole.rbuild?rev=22282&view=auto
==============================================================================
--- trunk/rosapps/tests/readconsole/readconsole.rbuild (added)
+++ trunk/rosapps/tests/readconsole/readconsole.rbuild Thu Jun  8 16:59:32 2006
@@ -1,0 +1,5 @@
+<module name="readconsole" type="win32cui" installbase="bin" installname="readconsole.exe">
+	<define name="__USE_W32API" />
+	<library>kernel32</library>
+	<file>main.c</file>
+</module>




More information about the Ros-diffs mailing list