sprintfkStrings:Manipulationsprintfksprintfk
printf-style formatted output to a string variable at k-rate.
Descriptionsprintfk writes printf-style formatted output to a string variable, similarly to the C function sprintf(). sprintfk runs both at initialization and performance time.
SyntaxSdst sprintfk Sfmt, xarg1[, xarg2[, ... ]]InitializationSfmt -- format string, has the same format as in printf() and other similar C functions, except length modifiers (l, ll, h, etc.) are not supported. The following conversion specifiers are allowed:
d, i, o, u, x, X, e, E, f, F, g, G, c, sxarg1, xarg2, ... -- input arguments (max. 30) for format, should be i-rate for all conversion specifiers except %s, which requires a string argument. sprintfk also allows k-rate number arguments, but these should still be valid at init time as well (unless sprintfk is skipped with igoto). Integer formats like %d round the input values to the nearest integer.
PerformanceSdst -- output string variable
Examples
Here is an example of the sprintfk opcode. It uses the file sprintfk.csd.
Example of the sprintfk opcode.See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
Its output should include lines like this:
1 + 1 = 2
1 + 1 + 1 = 3
1 + 1 + 1 + 1 = 4
1 + 1 + 1 + 1 + 1 = 5
1 + 1 + 1 + 1 + 1 + 1 = 6
1 + 1 + 1 + 1 + 1 + 1 + 1 = 7
1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 8
1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 9
1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 10
1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 11
1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 12See AlsoString Manipulation OpcodesCreditsAuthor: Istvan Varga2005Example by Jonathan Murphy