diff --git a/BeefLibs/corlib/src/IO/Stream.bf b/BeefLibs/corlib/src/IO/Stream.bf index f70f49ad..8b3c3d0f 100644 --- a/BeefLibs/corlib/src/IO/Stream.bf +++ b/BeefLibs/corlib/src/IO/Stream.bf @@ -115,6 +115,22 @@ namespace System.IO return .Ok; } + //Reads null terminated ASCII string from the stream. Null terminator is read from stream but isn't appended to output string + public Result ReadNullTerminatedString(String output) + { + Result char0; + while(true) + { + char0 = Read(); + if(char0 == .Err) + return .Err; + if(char0.Value == '\0') + return .Ok; + + output.Append(char0.Value); + } + } + public Result Read() where T : struct { T val = ?;