Positron Compiler Documentation

Strn

Source: Positron8 Compiler User Manual, PDF page 369

Syntax

Strn Byte Array = Item

Overview

Load a Byte Array with null terminated data, which can be likened to creating a pseudo String variable.

Parameters

Byte Array is the variable that will be loaded with values. Item can be another Strn command, a Str command, Str$ command, or a quoted character string

Example

' Load the Byte Array String1 with null terminated characters
  Device = 18F26K40
                                       ' A suitable device for Strings
  Declare Xtal = 16
                                ' Tell the compiler the device is operating at 16MHz
  Declare Hserial_Baud = 9600
  Dim String1[21] as Byte
                             ' Create a Byte array with 21 elements
  Strn String1 = "Hello World"
  ' Load String1 with characters and null terminate it
  HRsoutLn Str String1
                             ' Display the string
  Stop

See also

Arrays as Strings, Str$.