next up previous contents index
Next: The write Command Up: Input and Output Commands Previous: Input Format Notes   Contents   Index


The sprint Command

The sprint command is used to print vector data to a string-type variable.

sprint vname [/format] [line] expr [...]

This is very similar to the print command, however by default output is created as a text string in a variable whose name is given in the first argument. Variable substitution can then be used to poke the string text into other commands or output. However, if the first argument is a hyphen (`-'), then the text is printed to the standard output, as for the print command.

The output consists of a single line of text, which may be formatted according to the format string, which if given must be the second argument and is prefixed by a forward slash (`/') character. This is identical to the format string as described for the print command, with inapplicable modes or flags ignored. Only the `line' mode of the print command is supported, if the explicit keyword is given it is ignored, however if the `col' keyword is given explicitly, an error results. The default format is line so the keyword is never needed.

The values of vector results from expressions that follow are formatted and appear in the result string. Each vector index value will appear so that the resulting string can be quite long. It is likely that this function will be used only for single scalar values.


next up previous contents index
Next: The write Command Up: Input and Output Commands Previous: Input Format Notes   Contents   Index
Stephen R. Whiteley 2024-09-29