core :: Reader :: read_string
To be used with Writer::write_string
.
Returns a truncated string when an error is pending (last_error != null
).
# Read a null terminated string
#
# To be used with `Writer::write_string`.
#
# Returns a truncated string when an error is pending (`last_error != null`).
fun read_string: String
do
var buf = new Bytes.empty
loop
var byte = read_byte
if byte <= 0 then
return buf.to_s
end
buf.add byte
end
end
lib/binary/binary.nit:174,2--189,4