ByteStream.readCString()

This commit is contained in:
2022-06-09 19:30:58 +00:00
parent e6239bf93b
commit f93ec68029

View File

@@ -35,4 +35,15 @@ class ByteStream {
position += 2; position += 2;
return int; return int;
} }
// Read a C-style 0-terminated ascii string
public function readCString():String {
var string = "";
while (true) {
var next = readByte();
if (next == 0) break;
else string += String.fromCharCode(next);
}
return string;
}
} }