6663b6c9
adorian
projet complet av...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include <ion.h>
namespace Ion {
namespace Console {
char readChar();
void writeChar(char c);
void writeLine(const char * line) {
while (*line != 0) {
writeChar(*line++);
}
writeChar('\r');
writeChar('\n');
}
void readLine(char * line, int maxLineLength) {
if (maxLineLength <= 0) {
return;
}
char * cursor = line;
char * last = line+maxLineLength-1;
while (true) {
*cursor = readChar();
if (*cursor == '\r' || cursor == last) {
*cursor = 0;
return;
}
cursor++;
}
}
}
}
|