diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/std.zc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/std.zc b/src/lib/std.zc index 33ab1e9..772b887 100644 --- a/src/lib/std.zc +++ b/src/lib/std.zc @@ -73,7 +73,8 @@ int libinit() { // rt.put_s("hello world!"); // nothing on the terminal // std.capture.end(buf); // rt.put_s(buf); // hello world! -// the buffer holds 256 characters, and output past that is dropped. +// the buffer holds 256 characters, and output past that is dropped. it has one +// more word for the 0 that end() writes, so a full capture is still a string. // one capture at a time, and the buffer belongs to whoever holds it. struct capture { // starts a capture: output goes into a new buffer instead of the terminal. @@ -81,7 +82,7 @@ struct capture { static char* start() { int cap = 256; rt.outmode = 2; rt.outn = 0; rt.outcap = cap; - rt.outbuf = rt.new(cap); + rt.outbuf = rt.new(cap + 1); return rt.outbuf; } // stops the capture and ends the buffer with a 0. |
