Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Filling string arrays


4 replies to this topic

EberhardH

EberhardH
  • Members
  • 137 posts

Posted 22 November 2002 - 11:16

Hi,

I've got to fill a lot of string arrays with many values. But it is clumsy to just assign one after the other, like
Code Sample

sgCheck(0) = "F";
sgCheck(1) = "MPR";
sgCheck(2) = "E";
sgCheck(3) = "-";
//etc.

Is there a chance of assigning all of the values at once to the array? I thought of something like
sgCheck() = "F", "MPR", "E", "-", ... ;

Eberhard

danham

danham
  • Members
  • 5 posts

Posted 23 November 2002 - 08:36

Hi

Is it not possible to put the whole thing in a for/while  loop?

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 23 November 2002 - 18:43

You can make a loop work, but you need to change how you store the string constants.

One way would be to make a super-long string constant and have each item separated by a special unused character such as a semicolon.  Then you could parse through the string and grab what resides between the two special charcaters (i.e. a semicolon).  You'll just need to special case the first & last string values.

Another way is to store those string values externally in a separate text file.  Each line of the file would be a separate value, so you would simply open the file and read a line for each array element.  I'd suggest putting the text file under your project's Setup Files, so it's easily accesible at runtime.


user posted image

EberhardH

EberhardH
  • Members
  • 137 posts

Posted 25 November 2002 - 07:11

Thank you (Danham & TacoBell00) for your suggestions.
It's a pity that InstallShield cannot do it similar to C language syntax ...

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 28 November 2002 - 00:56

Yeah, well InstallScript is no full blown programming language, so gotta make do with what you got.
user posted image