PhilN Member Licensed User Longtime User Jan 25, 2013 #1 Hi all, I get this error: Cannot cast type: {Type=Byte,Rank=0} to: {Type=Byte,Rank=1} Code: Copy Dim ScratchSTR As String Dim ScratchByte As Byte Dim ScratchInt As Int Dim BConv As ByteConverter ScratchByte = BConv.StringToBytes(ScratchSTR, "UTF8") ScratchInt = BConv.IntsFromBytes(ScratchByte) What the difference between a byte rank0 and a byte rank1? Is there anyone who can help to resolve this? Please... :sign0163: Any help is much appreciated...
Hi all, I get this error: Cannot cast type: {Type=Byte,Rank=0} to: {Type=Byte,Rank=1} Code: Copy Dim ScratchSTR As String Dim ScratchByte As Byte Dim ScratchInt As Int Dim BConv As ByteConverter ScratchByte = BConv.StringToBytes(ScratchSTR, "UTF8") ScratchInt = BConv.IntsFromBytes(ScratchByte) What the difference between a byte rank0 and a byte rank1? Is there anyone who can help to resolve this? Please... :sign0163: Any help is much appreciated...
mc73 Well-Known Member Licensed User Longtime User Jan 25, 2013 #2 Rank1 is an array. StringToBytes gets your string and returns an array of bytes, you can declare it as Code: Copy dim ScratchByte() as byte . IntsFromBytes needs an array of bytes as input and returns again an array of ints. Thus you should declare Code: Copy Dim ScratchInt() as int . Here's the documentation for byteConverter. Upvote 0
Rank1 is an array. StringToBytes gets your string and returns an array of bytes, you can declare it as Code: Copy dim ScratchByte() as byte . IntsFromBytes needs an array of bytes as input and returns again an array of ints. Thus you should declare Code: Copy Dim ScratchInt() as int . Here's the documentation for byteConverter.