Hi Len, You could use a repeat loop, similar to
repeat with x = 1 to myNrOfWords get binaryDecode("h*",word x of myData,myTempVar) put myTempVar into myArray[x] end repeat -- Kind regards, Mark Schonewille Economy-x-Talk Http://economy-x-talk.com Share the clipboard of your computer over a local network with Clipboard Link http://clipboardlink.economy-x-talk.com Op 20 feb. 2012 om 01:08 heeft Len Morgan <len-mor...@crcom.net> het volgende geschreven: > Related to my problem with reading binary data from a socket, how do I handle > a variable number of numbers that will come in with binaryDecode? > > To explain, I get a number in the packet header that tells me there are x > number of bytes to follow in this packet. I know the first byte is a remote > ID and the second is a function code. Based on the function code, the number > of two byte integers that follows is going to be (the number of bytes in the > message / 2) - 1 (for the function code and remote ID). One time there might > be 2 integers to follow, another there might be 10. There is a "number of > words" number that is part of the command so I know how many words there will > be but the binaryDecode function requires that I specify a name for each > variable that is going to get a value. > > Ideally, I'd like to put all of these words in an array so I can process > them, but this doesn't seem to be an option for the binaryDecode command. > Should I build up a string that has "...,var[0],var[1],...,var[x] in it to > account for all the variables and then use a "do" or "dispatch" to actually > do the binaryDecode? > > Also, if I use var[0], var[1], etc., do I need to create ALL of the indexes > first (for binaryDecode) or will just creating the first one (var[0]) be > sufficient? > > Thanks, > > len morgan > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode