summaryrefslogtreecommitdiff
path: root/reference/C/EXAMPLES/clrscr.c
diff options
context:
space:
mode:
Diffstat (limited to 'reference/C/EXAMPLES/clrscr.c')
-rw-r--r--reference/C/EXAMPLES/clrscr.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/reference/C/EXAMPLES/clrscr.c b/reference/C/EXAMPLES/clrscr.c
new file mode 100644
index 0000000..a002dd3
--- /dev/null
+++ b/reference/C/EXAMPLES/clrscr.c
@@ -0,0 +1,22 @@
+/*************************************************************************
+ *
+ * Purpose: Clear the screen with VT100 escape codes. This can be done
+ * with conio.h on PCs - non standard code. Or curses.h, bit of
+ * a fag...
+ * Author: M.J. Leslie
+ * Date: 22-Jun-94
+ *
+ ************************************************************************/
+
+void clrscr(void);
+
+main()
+{
+ clrscr();
+}
+
+void clrscr(void)
+{
+ printf("\033[2J"); /* Clear the entire screen. */
+ printf("\033[0;0f"); /* Move cursor to the top left hand corner */
+}