Numworks Epsilon  1.4.1
Graphing Calculator Operating System
console_line.cpp
Go to the documentation of this file.
1 #include <ion.h>
2 
3 namespace Ion {
4 namespace Console {
5 
6 char readChar();
7 void writeChar(char c);
8 
9 void writeLine(const char * line) {
10  while (*line != 0) {
11  writeChar(*line++);
12  }
13  writeChar('\r');
14  writeChar('\n');
15 }
16 
17 void readLine(char * line, int maxLineLength) {
18  if (maxLineLength <= 0) {
19  return;
20  }
21  char * cursor = line;
22  char * last = line+maxLineLength-1;
23  while (true) {
24  *cursor = readChar();
25  if (*cursor == '\r' || cursor == last) {
26  *cursor = 0;
27  return;
28  }
29  cursor++;
30  }
31 }
32 
33 }
34 }
char readChar()
Definition: console.cpp:10
void writeLine(const char *line)
Definition: console_line.cpp:9
c(generic_all_nodes)
void readLine(char *line, int maxLineLength)
void writeChar(char c)
Definition: console.cpp:16
Definition: backlight.h:6