
Writing Technician Interface Scripts
2-32
308660-14.00 Rev 00
<conversion_specification>
can be one of the following:
•
d or i indicates signed decimal notation.
•
o indicates unsigned octal notation (no leading zero).
•
x or X indicates unsigned hexadecimal notation (no 0x prefix).
•
u indicates unsigned decimal.
•
c indicates a single unsigned character.
•
s indicates a character string.
• A percent sign (
%) means to print a %.
If you enter the
printf command incorrectly, the console returns one of the
following error messages:
• printf: Expected numeric argument; invalid string argument found
The %
<conversion_specification>
expected numeric data in the input
argument, which contained a text string (“hello there”) instead of a number
(123).
• printf: Format string has more format codes than there are arguments
The <
format
> string has more conversion specifications than there are input
arguments (<
p1
>,. . .,<
pN
>).
•
printf: Invalid format code
You entered an invalid conversion specification in the format string (
%z).
Example
The following example shows a sample printf command:
let slot = 2
printf “Slot: %5d\n” $slot
Commenti su questo manuale