Anytime Help Center

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Support
  • Guest
  • Log In
English (US)
US English (US)
DE German
CN Chinese
MX Spanish (Mexico)
Chinese (Simplified)
  • AKG
    Microphones Wireless Integrated Systems Automatic Mixers Headphones Discontinued Products (AKG) General AKG Inquiries Certifications (AKG)
  • AMX
    Networked A/V Distribution (AVoIP) Traditional A/V Distribution Video Signal Processing Architectural Connectivity User Interfaces Control Processing Power (AMX) Programming (AMX) Software (AMX) Discontinued Products (AMX) General AMX Inquiries Certifications (AMX)
  • BSS
    Soundweb™ Omni Soundweb™ London Soundweb™ Contrio™ Software (BSS) Discontinued Products (BSS) General BSS Inquiries Certifications (BSS)
  • Crown
    CDi DriveCore Series CDi Series Commercial Series ComTech Series DCi DriveCore Series I-Tech HD Series XLC series XLi Series XLS DriveCore 2 Series XTi 2 Series Discontinued Products (Crown) Software (Crown) General Crown Inquiries Certifications (Crown)
  • dbx
    CX Series 500 Series DriveRack Personal Monitor Control ZonePRO Zone Controllers FeedBack Suppression Microphone Preamps Dynamics Processors Crossovers Equalizers Software (dbx) Discontinued Products (dbx) General dbx Inquiries Certifications (dbx)
  • Flux::
    Immersive Processing Analysis Subscriptions
  • JBL
    Cinema Sound Installed Live Portable Tour Sound Recording & Broadcast Software (JBL) Discontinued Products (JBL) Video Manual Series (JBL) General JBL Inquiries Certifications (JBL)
  • Lexicon
    Plugins Effects Processors Cinema Discontinued Products (Lexicon) Video Manual Series (Lexicon) General Lexicon Inquiries Certifications (Lexicon)
  • Martin
    Atomic ELP ERA Exterior MAC P3 VC VDO Tools Discontinued Products (Martin) General Martin Inquiries Certifications (Martin)
  • Soundcraft
    Digital Analog Connected Analog Only Discontinued Products (Soundcraft) Video Manual Series (Soundcraft) General Soundcraft Inquiries Certifications (Soundcraft)
  • General HARMAN Inquiries
    Dante
+ More
  • Home
  • AMX
  • Programming (AMX)
  • Programming

531-How to Initialize Character Strings in the DEFINE_CONSTANT and DEFINE_VARIABLE Sections

Technical Support Guide

Written by Will Fraser

Updated at February 5th, 2026

Table of Contents

Brand: Models: Explanation: Examples: A non-ASCII string: An ASCII string: A string expression: A 2-dim array of strings: Alternate 2-dim array init for string literals ONLY:

Brand:

  • AMX

Models:

  • Netlinx

Explanation:

In Axcess, initializing strings in the DEFINE_CONSTANT section was easy - you just wrote them the same way you would elsewhere in the program.

This doesn't work in NetLinx - there are some different rules to follow.

The strings must be enclosed by curly braces {}, not double-quotes " ".
Commas must separate all characters, unless it is only ASCII printable characters, AKA a string literal.
If it is a string literal, there are ways to initialize the string without separating every byte.  Braces are optional.
However, there are some added benefits that are not possible in Axcess:

You can initialize the strings in either the DEFINE_CONSTANT or DEFINE_VARIABLE sections.
The compiler will determine the lengths for you - you don't need to explicitly give a length, just the [] to tell the compiler it's a string array.
You can initialize multidimensional arrays.  The "total length" of the last dimension will be length of the longest string used to initialize the array.
If you are initializing a multidimensional array of string literals, if you specify the size of the last dimension, then you do not have to separate every byte with a comma.
In all other cases, specifying the size of the array is optional.  Some programmers prefer to always specify the size when declaring or initializing arrays.


Examples:


A non-ASCII string:

sMyMIDIString[] = {$B0,7,127}

An ASCII string:

sMyString[] = {'H','e','l','l','o'} //This is the same syntax as used with non-ASCII strings or string expressions.

Or

sMyString[] = 'Hello' //This only works with ASCII string literals, it is the most similar to Axcess syntax.

Or

sMyString[] = {'Hello'} //Optionally, the ASCII string can be enclosed in braces.

A string expression:

sProjOn[] = {$02,'P','O','N',$03}

Notice that a string literal inside a string expression must have every byte separated by a comma.

A 2-dim array of strings:

sZoneNames[][] = {
{'M','a','s','t','e','r',' ','C','l','o','s','e','t'}, //Stat 1
{'M','a','s','t','e','r',' ','B','a','t','h'}, //Stat 2
{'M','a','s','t','e','r',' ','B','e','d','r','o','o','m'}, //Stat 3
{'M','a','s','t','e','r',' ','D','r','e','s','s','i','n','g'}, //Stat 4

{'M','a','s','t','e','r',' ','S','i','t','t','i','n','g'}, //Stat 5
{'K','i','t','c','h','e','n','/','U','t','i','l','i','t','y'},//Stat 6
{'T','h','e','a','t','e','r'}, //Stat 7
{'B','r','e','a','k','f','a','s','t'}, //Stat 8

{'G','a','m','e',' ','R','o','o','m'}, //Stat 9
{'O','f','f','i','c','e'}, //Stat 10
{'F','o','y','e','r'}, //Stat 11
{'G','r','e','a','t',' ','R','o','o','m'}, //Stat 12

{'D','i','n','i','n','g',' ','R','o','o','m'}, //Stat 13
{'G','u','e','s','t',' ','B','e','d','r','o','o','m'}, //Stat 14
{'T','V','/','S','t','u','d','y'}, //Stat 15
{'B','e','d','r','o','o','m',' ','4'}, //Stat 16

{'B','e','d','r','o','o','m',' ','3'}, //Stat 17
{'S','t','o','r','a','g','e'} //Stat 18
}

Alternate 2-dim array init for string literals ONLY:

You must specify the size of the last dimension as a length large enough to hold the longest string literal to be stored.

sZoneNames1[][16] =
{
'Master Closet', //Stat 1
'Master Bath', //Stat 2
'Master Bedroom', //Stat 3
'Master Dressing', //Stat 4

'Master Sitting', //Stat 5
'Kitchen/Utility', //Stat 6
'Theater', //Stat 7
'Breakfast', //Stat 8

'Game Room', //Stat 9
'Office', //Stat 10
'Foyer', //Stat 11
'Great Room', //Stat 12

'Dining Room', //Stat 13
'Guest Bedroom', //Stat 14
'TV/Study', //Stat 15
'Bedroom 4', //Stat 16

'Bedroom 3', //Stat 17
'Storage' //Stat 18
}

 

 

Related Videos

blueprint framework

Was this article helpful?

Yes
No
Give feedback about this article

Table of Contents

Brand: Models: Explanation: Examples: A non-ASCII string: An ASCII string: A string expression: A 2-dim array of strings: Alternate 2-dim array init for string literals ONLY:

Related Articles

  • AMX REPLACE_STRING
  • AMX SPLIT_STRING
  • Hexadecimal and Bitwise, an explanation

Related Articles

  • AMX REPLACE_STRING
  • AMX SPLIT_STRING
  • Hexadecimal and Bitwise, an explanation
Copyright © HARMAN Professional. All rights reserved. Privacy Policy | Terms of Use
Expand