I "inherited" an old InstallShield 5.5 project which I need to modify. One change I need to do involves a list of strings I have to populate. I am looking to to define an array of strings. I tried this:
STRING ListOfStrings[10];
But when I try this:
ListOfStrings[1] = "test";
I get an error: error C8038: numeric value required
But this does work:
ListOfStrings[1] = 123;
Looks like the declaration of the ListOfStrings is of an array of chars, not an array of strings.
That's right, the notation STRING str[10]
declares an array of 10 characters. (STRING itself is a resizable array of characters.) InstallScript is not a modern language. It's somewhat of a cross between C and VB, but changes several things. If you want a list of strings, you probably need to use the List Processing Functions, in particular declaring and creating a list of strings:
LIST lst;
STRING szString;
// : : :
lst = ListCreate(STRINGLIST);
szString = "test";
ListAddString(lst, szString, AFTER);
// : : :
In addition you should use some error checking, like that shown on the ListAddString example.
In less common situations it may be useful to declare an array of POINTER
objects (or optionally WPOINTER
objects in later versions). (Update your question if you think that might be necessary).