Matrix1 Utility Plug-ins

WRITELN LOG


Syntax

WRITELN LOG Format$ [, Arguments]
WRITELN LOG TagNumber, Format$ [, Arguments]

Description

Write the specified data to the log file if it has been opened. The line output is terminated by a newline.

*WARNING* Incorrectly matching format data and their arguments will cause your application to crash - use with care.

When using the first form of the command, the formatted text will be written straight to the log file. The format string is used to describe the data format and the argument types, and up to 8 arguments of DBPro's basic type can be passed as arguments.

When using the second form, the prefix data for the tag number is output, followed by the formatted data, and then finally by and postfix data for the tag number.

Although the format string is similar to the C 'printf' function, it has been modified and simplified for easier use with DBPro.

The layout of argument specifiers in the format string is: %[flags][width][.precision][type-extension][type]

Type:
c - convert the integer number passed to it's character equivalent -flags, width and precision are ignored.
i or d - integer number
e - float in exponent format
f - float in decimal format
g - float in shorter or 'e' or 'f' format
s - string
x - hexadecimal of integer number
p - Pointer form (equivalent to displaying an integer using %#08x)

E - Like 'e', but shows the exponent in uppercase
G - Like 'g', but shows the exponent in uppercase
X - Like x, but shows hex digits in uppercase

Type extension:
l - value passed is a double-sized numeric value (eg, double float, or double integer)
u - value passed is unsigned (only works for integer value)

Precision:
For floating point output, specifies the number of decimal places to allow.
For strings, specifies the maximum length of the string output.
For integers, specifies the minimum number of digits to output.

Width:
The output will be extended to the width specified with spaces.
If the output is numeric, and if the width starts with a leading zero, the output will be padded with leadingzeros.
Padding will follow the alignment rules (see - flag above) for strings.

Flags:
- = left align (default is to align on the right)
+ = display sign (default is no sign shown for positive numbers)
space = space for positive numbers
# = Display prefix of '0x' or '0X' for hexadecimal numbers, or always show a decimal point for floating point numbers.

DBPro's internal type system converts to the following type and extension:
s - string
ui,ud - byte, word, dword
i,d - integer
f,e,g - float
li - double integer
lf - double float

Special formatting is signalled by a % character - to get a % character into the log file, use %%.

The following command:
WRITELN LOG "Hello %i %.8s", 2, "everyone here"

Will write the following to the log destination.
Hello 2 everyone

Go back to ...

Matrix1Util_10 Commands Menu
Matrix1 Utils Main Index
Matrix1 Utils Command List
Commands Menu
Main Menu

Copyright © Ian Mold - Matrix1 Software 2006 - 2011