printf
- Print formatted output to the output window.

String manipulation
(AmiBroker 4.50)


SYNTAX printf( formatstr, ... )
RETURNS NOTHING
FUNCTION The printf function formats and prints a series of characters and values to the output window, which can be either commentary or interpretation window.

If arguments follow the format string, the format string must contain specifications that determine the output format for the arguments.

printf and StrFormat behave identically except that printf writes output to the window, while StrFormat does not write anything to output window but returns resulting string instead.

Note 1: for numbers always use %f, %e or %g formatting, %d or %x will not work because there are no integers in AFL.

Note 2: as of now only numbers and arrays can now be printed. For arrays 'selected value' is printed

Note 3: to print a single percent-sign character, you can not type % alone, you must use %%.

Note 4: read more about various % format specifiers on: https://www.google.com/search?q=printf+format+specifiers

Starting from version 6.10, printf/StrFormat now implement a check for correct formatting string as sometimes users passed strings with % that is special marker for formatting string instead of %% to print actual percent sign. When check failes, "Error 61. The number of % formatting specifier(s) does not match the number of arguments passed." is displayed

Starting from version 6.20, printf/StrFormat support now "%s" (string specifier)

EXAMPLE for( i = 0; i < 10; i++ )
{
   
printf( "Hello world, line %g\n", i );
}
SEE ALSO StrFormat() function

References:

The printf function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.