blob: a87739222cdbf16b8ef24b1a0f2f8d61f6349b13 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include "TextFile.class.h"
bool TextFile::write(String str, bool addnl) {
ByteArray a(str, m_encoding);
if (addnl) a += (u8int)'\n';
return File::write(a);
}
String TextFile::readLine(char separator) {
ByteArray buffer;
while (1) {
char c;
if (read(1, (u8int*)&c) == 0) {
return buffer.toString(m_encoding);
}
if (c == separator) {
return buffer.toString(m_encoding);
}
buffer += (u8int)c;
}
}
|