MNIST-3LNN  1.0
A simple 3-layer neural network to recognize handwritten single digit numbers from the MNIST image files.
screen.c
Go to the documentation of this file.
1 /**
2  * @file screen.c
3  * @brief Utitlies for advanced input and output to terminal screen
4  * @author Matt Lind
5  * @date July 2015
6  */
7 
8 #include <stdio.h>
9 #include <string.h>
10 #include "screen.h"
11 
12 
13 
14 
15 /**
16  * @details Clear terminal screen by printing an escape sequence
17  */
18 
19 void clearScreen(){
20  printf("\e[1;1H\e[2J");
21 }
22 
23 
24 
25 
26 /**
27  * @details Set text color in terminal by printing an escape sequence
28  */
29 
30 void setColor(Color c){
31  char esc[5];
32  strcpy(esc, "0;00"); // default WHITE
33  switch (c) {
34  case WHITE : strcpy(esc, "0;00");
35  break;
36  case RED : strcpy(esc, "1;31");
37  break;
38  case GREEN : strcpy(esc, "1;32");
39  break;
40  case YELLOW: strcpy(esc, "1;33");
41  break;
42  case BLUE : strcpy(esc, "1;34");
43  break;
44  case CYAN : strcpy(esc, "1;36");
45  break;
46  }
47  printf("%c[%sm",27,esc);
48 }
49 
50 
51 
52 
53 /**
54  * @details Set cursor position to given coordinates in the terminal window
55  */
56 
57 void locateCursor(const int row, const int col){
58  printf("%c[%d;%dH",27,row,col);
59 }
void setColor(Color c)
Set text color in terminal by printing an escape sequence.
Definition: screen.c:30
Utitlies for advanced input and output to terminal screen.
Definition: screen.h:8
Definition: screen.h:8
void locateCursor(const int row, const int col)
Set cursor position to given coordinates in the terminal window.
Definition: screen.c:57
Definition: screen.h:8
void clearScreen()
Clear terminal screen by printing an escape sequence.
Definition: screen.c:19
Color
Definition: screen.h:8
Definition: screen.h:8
Definition: screen.h:8
Definition: screen.h:8