quote:
Originally posted by Heffy
Oh, and a note: the integers wouldn't be sent as integers, they'd be sent as a string, by default (sending data from the command arguments). The conversion to integer will happen after the person receives the data.
yes, that's what I was saying in the first place
quote:
Originally posted by Choli
i wouldn't do that because there may be problems with integers which one of their bytes is zero... that would be the NUL character used to mark the end of a string and that could give problems because messenger would only send the first bytes up to the first zero (NUL) byte.
For example:
code:
'......
Dim I1 as Integer
Dim I2 as Integer
Dim I3 as Integer
'.......
I1 = 1234
I2 = 0
I3 = 4500
'.....
sResult = Chr$(nCCNotify) & "smvpg" & ChrW$(I1) & ChrW$(I2) & ChrW$(I3)
' ^ that would create a string that has the notify code, the letters "smvpg",
' two bytes (&H4 and &HD2) and then two bytes set to zero
' and finally two bytes more (&H11 adn &H94)
' but the first byte set to zero (coming from I2) will indicate end of string
' (remember that in C, strings end in '\0')
' That would cause problems when sending the message
In fact, if the integers are in the range 0..255 or if they are a multiple of 256 (including negative multiples) that issue would happen.
Yeah, didn't think of that.... although it would only happen when the integer is 0, because text like that is unicode and thus each character is read in pairs of two bytes. So in the pair of 0x45 0x00, the 0x00 isn't an end of string marker. The end of string marker in unicode consists of a 0 word (integer value 0), not a 0 byte. Or so it should be... didn't tested this though...
quote:
Originally posted by Choli
As a work arround for that, maybe the best way to send the numbers would be in hexadecimal format...
yup, or the first method I mentioned. Well, actually those two are the same, you both send the numbers/digits as literal characters. But with the hexadecimal style you could send more integers at once...
(thinking of it, you could make your base 36 and use all the letters of the alphabeth and thus sending even more integers... or even an higher base using other ascii characters
)