aboutsummaryrefslogtreecommitdiffhomepage
path: root/demo/ex2.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2011-10-11 15:05:38 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2011-10-11 15:05:38 +0200
commit1efec3952b780cc675ae111313017c3b91d20a01 (patch)
tree8a2d77b52e2c558976c8d2d362edf8837e2066ea /demo/ex2.c
downloaderlang-slang-fork-1efec3952b780cc675ae111313017c3b91d20a01.tar.gz
initial commit based on erlang-slang 1.0 release (debian tar ball)
Diffstat (limited to 'demo/ex2.c')
-rw-r--r--demo/ex2.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/demo/ex2.c b/demo/ex2.c
new file mode 100644
index 0000000..bbfa980
--- /dev/null
+++ b/demo/ex2.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <slang.h>
+
+int main ()
+{
+ int abort_char = 7; /* For MSDOS, use 34 as scan code */
+ unsigned int ch;
+
+ if (-1 == SLang_init_tty (abort_char, 0, 1))
+ {
+ fprintf (stderr, "Unable to initialize the terminal.\n");
+ exit (-1);
+ }
+ SLang_set_abort_signal (NULL);
+
+ fflush (stdout);
+
+ ch = SLang_getkey ();
+
+ printf("<< %c >> %d ",ch, SLang_Error);
+
+ SLang_reset_tty ();
+ return 0;
+}
+
+
+
+