Using Null-Delimited Strings
InstallShield 2020
Project:This information applies to InstallScript projects.
Note the following when using a null-delimited, double-null-terminated string (for example, abc\0def\0ghi\0\0; such strings are also sometimes referred to as multiple null-delimited strings or multiple null-terminated strings):
|
•
|
When declaring a variable that will be set to a null-delimited string value, explicitly size the variable; for example: |
STRING szString[1024];
Do not use autosizing; the installation engine expects autosized strings to not include null characters within the string.
|
•
|
Do not try to create arrays of null-delimited strings; since array elements must always be autosized, string arrays do not currently support this type of string. |
|
•
|
The specified size of a null-delimited string should be at least the number of characters to be stored plus two for the two terminating null characters. |
|
•
|
Since strings are automatically initialized to all null characters, you do not need to explicitly set the second-to-last character to null (though this will not cause any adverse effects) unless you have previously set the second-to-last character to something other than null. |
|
•
|
The best way to determine the length of a null-delimited string is to call the CharReplace function to replace the null characters and then call the StrLengthChars function to determine the size of the resulting string. |
|
•
|
The StrGetTokens and StrPutTokens functions may be useful when working with null-delimited strings. |
|
•
|
Most InstallScript functions other than the ones noted above do not work with multiple null-delimited strings. If you want to use a multiple null-delimited string with a built-in function, use the CharReplace function first to replace the null characters with another character, such as an underscore (_). |