Checksum Question - Part 2
deepforestgreen
Posts: 51
Working with this:
define_function integer getChecksum(char cmd[])
{
stack_var integer bTotal
stack_var integer nLength
stack_var integer nCT
nLength = LENGTH_STRING(cmd - 1)
nCT = 1
for(nCT=1;nCT<=8;nCT++)
{
bTotal = bTotal + cmd[nCT]
}
bTotal = bTotal & $FF
return bTotal
}
Getting this:
'String used as a CHAR value in a math operation' in relation to the line that says 'nLength = LENGTH_STRING(cmd - 1)'
I'm stumped. I'm trying to get rid of these warnings so I can learn more about this part of the programming, but I'm at a loss. I just fixed a handful of similar problems and learned a lot in the process, but this one isn't coming to me.
define_function integer getChecksum(char cmd[])
{
stack_var integer bTotal
stack_var integer nLength
stack_var integer nCT
nLength = LENGTH_STRING(cmd - 1)
nCT = 1
for(nCT=1;nCT<=8;nCT++)
{
bTotal = bTotal + cmd[nCT]
}
bTotal = bTotal & $FF
return bTotal
}
Getting this:
'String used as a CHAR value in a math operation' in relation to the line that says 'nLength = LENGTH_STRING(cmd - 1)'
I'm stumped. I'm trying to get rid of these warnings so I can learn more about this part of the programming, but I'm at a loss. I just fixed a handful of similar problems and learned a lot in the process, but this one isn't coming to me.
0
Comments
Should be
nLength = LENGTH_STRING(cmd)-1