Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Odd data showing up in an array

Status
Not open for further replies.

Riegg

Programmer
Mar 20, 2003
29
CA
Could someone shead some light on this:

I had this in a script where the sarray held 0's or a 1's...

while count < 41
atoi sarray [count] [1] iarray [count] [1]
count++
endwhile

I got all sorts of crazy data and mostly 0's in iarray

I had to do this to get it to work...

while count < 41
atoi sarray [count] [1] itemp
iarray [count] [1] = itemp
count++
endwhile
 
I don't know why the first example didn't work for you. The syntax is correct and when I tried it, it did work for me.

The only thing I would suggest is try removing the spaces from your array variables.
Code:
ie sarray[count][1]  instead of sarray [count] [1]

As for the example above, maybe a for loop would be more appropriate than a while loop as shown in the following example.
Code:
for count = 1 upto 40
atoi sarray[count][1] iarray[count][1]
endfor
 
Thanks... I have no clue where the crazy data came from... I did a usermsg before the while and everything was good and a usermsg after and the data was all messed up.... oh well
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top