cf. https://www.freepascal.org/docs-html/rtl/system/writestr.html
Unless some caveats arise, this should be straightforward:
- first parameter must be a
string variable
- printing further parameters to a buffer is already implemented
- copying up to max chars to the resulting string, too