Raptor:Raptor Scanf: Difference between revisions

From NewEagleWiki
Jump to navigation Jump to search
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[RaptorWiki|Return to the main Raptor page]]
[[Raptor-Platform|Return to the main Raptor page]]


[[Raptor:Strings|Return to Strings page]]
[[Raptor:Strings|Return to Strings page]]
Line 9: Line 9:


<p>A format specifiers has the following form %[*][width][length]specifier</p>
<p>A format specifiers has the following form %[*][width][length]specifier</p>
<p>Note: Simulink String blocks are not compatible with Raptor blocks. Please use Raptor String blocks.</p>


{| class="wikitable" style="width:50%;"
{| class="wikitable" style="width:50%;"
Line 129: Line 131:
|-
|-
! string
! string
| string
| r_string
| String handle
| String handle
|}
|}
Line 141: Line 143:
|-
|-
! string
! string
| string
| r_string
| Duplicate string handle
| Duplicate string handle
|-
|-

Latest revision as of 13:53, 14 September 2023

Return to the main Raptor page

Return to Strings page

Raptor™ Scanf

Description

This is used to read numerical or other types out of a string according to the provided format string. The format string is a standard C format string. A format string can contain both text to be matched and format specifiers which are used to read data from the string. The output ports for this block will be created based on the format string entered in the parameter. To match a % to the string use %%.

A format specifiers has the following form %[*][width][length]specifier

Note: Simulink String blocks are not compatible with Raptor blocks. Please use Raptor String blocks.

* Description
* Specifies that the data read by this specifier should be discarded
width Description
(number) The maximum number of characters to be read.

The length field modifies the default data type of the incoming port for a specifier.

length specifiers
d i u o x X f F e E g G a A c s
(none) int32 uint32 double uint8 string
hh int8 uint8
h int16 uint16
l uint16
specifier Output Example
d or i Signed integer -189
u Unsigned integer 254
o Unsigned octal 610
x Unsigned hexadecimal integer 7ff
X Unsigned hexadecimal integer (uppercase) 7FF
f Floating point, lowercase 1234.85
F Floating point, uppercase 1234.85
e Scientific notation, lowercase 1.23485e+3
E Scientific notation, uppercase 1.23485E+3
g Use the shortest representation of %e or %f
G Use the shortest representation of %E or %F
a Hexadecimal floating point, lowercase -0xd.32fep-2
A Hexadecimal floating point, uppercase -0XD.32FEP-2
c Character a
s String

Inputs

Input Type Description
string r_string String handle

Outputs

Output Type Description
string r_string Duplicate string handle
... Signals from string.

Parameters

Parameter Type Description
Format String String Specifies the format of the data to read from the string.