9 lines
244 B
Text
9 lines
244 B
Text
|
# Reads and returns a complete file as a string
|
||
|
var readfile = func(file) {
|
||
|
if((var st = stat(file)) == nil) die("Cannot stat file: " ~ file);
|
||
|
var sz = st[7];
|
||
|
var buf = bits.buf(sz);
|
||
|
read(open(file), buf, sz);
|
||
|
return buf;
|
||
|
}
|