@reitinge I did try this before but then I can't even compile due to an error.
23345552-af28-4c1c-b9d1-6a4c22f5c625-image.png
But apparently it was because I did the initialization of this string inside the main routine.
Bizarre that it is throwing a warning for the string 'stringTemp' and not for the long variable 'index'.
Both are only used inside the main routine.
This is the complete code which is now running without a warning :
//assigning inputs to variables, these variables are READ-ONLY
double input(0) inputGLAS;
double input(1) inputGFT;
double input(2) inputPMD;
double input(3) inputRA;
double input(4) inputTEXT;
double input(5) inputP_K;
//assigning variables to outputs, these variables are WRITE-ONLY
string output(0) stringOUT; //value to send to y0 output
char stringTemp[80];
//the init procedure is executed once when the REXLANG function block initializes
long init(void)
{
return 0;
}
//the main procedure is executed repeatedly (once in each sampling period)
long main(void)
{
long index = 0;
//char stringTemp[80];
stringTemp="";
strcat(stringTemp,"Vergeet+niet+volgend+vuilnis+buiten+te+zetten+:+");
if (inputGLAS!=0)
{
strcat(stringTemp,"Glas");
index=index+1;
}
if (inputGFT!=0)
{
if (index!=0)
{
strcat(stringTemp,",+");
}
strcat(stringTemp,"GFT");
index=index+1;
}
if (inputPMD!=0)
{
if (index!=0)
{
strcat(stringTemp,",+");
}
strcat(stringTemp,"PMD");
index=index+1;
}
if (inputRA!=0)
{
if (index!=0)
{
strcat(stringTemp,",+");
}
strcat(stringTemp,"Restafval");
index=index+1;
}
if (inputTEXT!=0)
{
if (index!=0)
{
strcat(stringTemp,",+");
}
strcat(stringTemp,"Textiel");
index=index+1;
}
if (inputP_K!=0)
{
if (index!=0)
{
strcat(stringTemp,",+");
}
strcat(stringTemp,"Papier+en+Karton");
}
stringOUT=stringTemp;
return 0;
}
//the exit procedure is executed once when the task is correctly terminated
// (system shutdown, downloading new control algorithm, etc.)
long exit(void)
{
/* PUT YOUR CODE HERE */
return 0;
}