>>Just quickie, I am writing a version of BString, just to cut my teeth, >>any objections/suggestions? >> Keith > >Sorry I have not posted back earlier. I believe that BStrings as it presently exists in BeOS is broken. The reason, it treats it's strings like 'C' strings in some cases using a zero byte to make the end of the string and at other times using the Length() function to tell it the string length to control string functions. > >I believe that BStrings should always use the Length() function and thus allow bytes containing zeros(0) to exist inside a string. > >Also note: If you read the BeBook BString section that there is no mention that BStrings are zero terminated, only that the String() function will return a zero terminated string. > > Earl Colby Pottinger > >PS. I am working a small test program to show what I mean, I will post the code as soon as possible. The internal representation of the characters in a BString should not make any difference. Keith should pick whatever implementation works the best. Users of the class should make no assumption about how the data is stored -- if they do, they deserve whatever trouble they get, haha! So yes, users should only rely on calling Length() and not on finding a terminating null. However, I would recommend *not allowing* zero bytes in BStrings. It would work technically, but from a design standpoint, it would confuse people. Making it clear that BString is only meant for textual strings and not binary data is in keeping with BString's API (for example, the buffer returned by String() is guaranteed to be null- terminated). If the need for a binary string class becomes necessary, we could write BBinaryString (or something to that effect) to handle that -- altho I think that good ole char * would be simpler.