blob: 85015a1fd0b6b137cdb03418a740cba0914ddcbb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
use io;
use strings;
use fmt;
export type error = !(str | io::error);
export fn writerecord(w: io::handle, record: []str) (void | error) = {
let sep = "";
for (const field .. record) {
const pfield = strings::replace(field, "\t", "");
defer free(pfield);
fmt::fprintf(w, "{}{}", sep, pfield)!;
sep = "\t";
};
fmt::fprintln(w)!;
};
export fn writerecords(w: io::handle, records: [][]str) (void | error) = {
for (const record .. records) {
writerecord(w, record)?;
};
};
|