sprintf:useful — ordinary primitive
EXTENSIONS
PFE-SPRINTF
( args ... format$ dest$ -- len-dest )( | ) ; |
; |
just like the standard sprintf() function in C, but the format is a counted string and accepts %#s to be the format-symbol for a forth-counted string. The result is a zeroterminated string at dest$ having a length being returned. To create a forth-counted string, you could use:
variable A 256 ALLOT 15 " example" " the %#s value is %i" A 1+ SPRINTF A C! A COUNT TYPE