Please enable JavaScript to view this site.

Function that performs formatting of a string based on the description provided by the user.

Syntax

i32 str_format (string buff, desc [, val1,  val2,  val3, ...])

buff

Variable containing the formatted string

desc

String constant containing the description of the format to be used during buff composition.

NOTE: Refer to the description of the C (ANSI standard) sprintf function for details and the formalism that can be used.

Code

Description

%d

Integer signed variable - Decimal representation

%u

Unsigned integer variable - Decimal representation

%x

Integer variable - Hexadecimal representation

%f

Real variable

%g

Real variable

%s

String variable - For system alarms only

val1, val2, val3, ...

Optional parameters, consisting of generic integer, real, or string expressions.

Must match exactly the formalism and number of parameters in the string desc

Result

Returns the number of bytes written in the buff string

Validity

Rule, Task

Note

It is the responsibility of the user to correctly match, in number and type, the optional parameters passed to the str_format() function. It must also be ensured that the formatting of the buff string does not require writing more characters than the declared size. The compiler is unable to identify and report any inconsistencies. This function should therefore be used with special warning, as it may cause system crashes or other runtime malfunctions

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC