This is how I would have "packed" the package to bytes.
Also when you do the Asci/byte math:
For Local i = 0 To p.size-1
p.bytes[i] = Asc( Mid$( msg,i+1,1 ) )
Next
This is the new BlitzMax Way. Nicer and easier to read once you get used to it.
For Local i = 0 To p.size-1
p.bytes[i] = msg[i]
Next
Also I also think you can use Until instead:
For Local i = 0 until p.size
p.bytes[i] = msg[i]
Next
Function Create:Packet(msg:String) Local p:Packet = New Packet p.size = Len(msg) p.bytes:Byte Ptr = msg.ToCString() 'Convert to bytes Return p End Function Method UnPack:String() Return String.FromBytes( bytes, size) End Method
Also when you do the Asci/byte math:
For Local i = 0 To p.size-1
p.bytes[i] = Asc( Mid$( msg,i+1,1 ) )
Next
This is the new BlitzMax Way. Nicer and easier to read once you get used to it.
For Local i = 0 To p.size-1
p.bytes[i] = msg[i]
Next
Also I also think you can use Until instead:
For Local i = 0 until p.size
p.bytes[i] = msg[i]
Next