need if that returns #digits from loop

im am trying to create an if statement to the effect of

if(msgIDcount <= 9)
{
msgIDmidSpaces = 2;
msgIDinttotextSpaces = 1;
}
else
{
msgIDmidspaces = 3;
msgIDinttotexSpaces = 2;

but cant get the placing right..
idea is that when msgIDcount is one digit or two
the mid and inttotext functions return the correct string.




cstring temp = input1;

if (unit1.message.msgArray[0] != temp)
{
int msgIDmidDigits;
int msgIDinttotextDigits;
int msgIDcount;

for(msgIDcount = 99; msgIDcount>=0; msgIDcount--)
if (Mid(temp,0,msgIDmidDigits) == IntToText(msgIDcount,10,msgIDinttotextDigits)+ ":")
{
unit1.message.msgArray[0] = temp;
unit1.message.MsgFlag = 1;
}
else
{
unit1.message.MsgFlag = 0;
}

//unit1.message.msgArray[0] = temp;

//replace separate lines with a for loop
if (unit1.message.msgArray[1] != unit1.message.msgArray[0])
{
int msgArrayCount;
for(msgArrayCount = 19; msgArrayCount>=0; msgArrayCount--)
{
unit1.message.msgArray[msgArrayCount+1] = unit1.message.msgArray[msgArrayCount];
}

}


unit1.message.msgIDcount = msgIDcount;
unit1.message.msgIDspaces = msgIDmidSpaces;
}
Last edited on
Topic archived. No new replies allowed.