include "cowgol.coh"; include "strings.coh"; sub MakeList(sep: [uint8], buf: [uint8]): (out: [uint8]) is out := buf; # return begin of buffer for ease of use var counter: uint32 := 0; # Add item to string sub AddStr(str: [uint8]) is var length := StrLen(str); MemCopy(str, length, buf); buf := buf + length; end sub; sub MakeItem(item: [uint8]) is counter := counter + 1; buf := UIToA(counter, 10, buf); AddStr(sep); AddStr(item); AddStr("\n"); end sub; MakeItem("first"); MakeItem("second"); MakeItem("third"); [buf] := 0; # terminate string end sub; var buffer: uint8[100]; print(MakeList(". ", &buffer as [uint8]));