QuoteMessage ID: 0x0B
Message Name: SID_GETCHANNELLIST
Direction: Server -> Client (Received)
Format:
(STRINGLIST) Channel names, terminated by a null string.
Remarks: Contains a list of available channels.
BNETDocs says stringlist, and I'm at a loss as to exactly what a stringlist is. Is a stringlist pretty much a single string and can be just put inside a string variable, or is there a different way stringlist is supposed to be handled?
Also, it says 'Terminated by a null string'-- is that in reference to EACH channel string being terminated by a null string, or the entire stringlist ENDING with a null string?
I'm lost... Thanks for any help, and for reading this!
According to BNETDocs (http://bnetdocs.valhallalegends.com/content.php?Section=d&id=8),
STRING Null-terminated array of characters.
STRING[] An array of strings (see above). This type is generally only used when another field in the packet specifies how many entries there are.
STRINGLIST A series of strings (see above) with an additional null-terminator at the end.
To make this even more clear, let's go with the 3 strings "123", "456", "789".
If this were a string[], it would be represented in-memory (and in-packet) as:
31 32 33 00 34 35 36 00 37 38 39 00
Often, a memory or packet location will tell the reader how many strings there are.
If it were a string list, it would be:
31 32 33 00 34 35 36 00 37 38 39 00 00
Note the extra null character. This tells a reader that it can stop reading.
And yes, I chose numerical digits because they're easy-to-remember codes. :P
So, for STRINGLIST, I just read the string, and use CHR(0) as the delimiter when I use the Split function on it, then use a for next array to display each item in the array?
For a stringlist I wouldn't use the Split() function. I'd go with reading it in a stream-like fashion.
Quote from: MyndFyre on September 12, 2005, 07:13 PM
For a stringlist I wouldn't use the Split() function. I'd go with reading it in a stream-like fashion.
Could you give an example, because I'm not really sure what you mean by 'steam-like fashion'?