Thanks guys. I just wanted a reality check. 
 
I'm moving some data from C# to C++ code, so I'll just have to duplicate
that algorithm over on the C++ side of things.
 
Cheers,
-John
http://www.iunknown.com
 

        -----Original Message----- 
        From: Henk de Koning 
        Sent: Thu 4/18/2002 4:34 PM 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: Re: [DOTNET] BinaryWriter.Write( string )
        
        

        7 bit int encoding is a wellknown variable lengtrh encoding. You
can find
        the definition of it in the Java class file format (and some
other places
        ;-);-).
        
        -- Henkk
        
        ----- Original Message -----
        From: "Marsh, Drew" <[EMAIL PROTECTED]>
        To: <[EMAIL PROTECTED]>
        Sent: Thursday, April 18, 2002 10:28 PM
        Subject: Re: [DOTNET] BinaryWriter.Write( string )
        
        
        > John Lam [mailto:[EMAIL PROTECTED]] wrote:
        >
        > > With short strings, it does write out the length as a single
        > > byte. With longer strings, it does expand it to a word. Now,
        > > when reading this thing back in, how does one determine
        > > whether the length prefix is one or two bytes????
        >
        > John,
        >
        > While I don't have time to totally dissect it right this
second, I whipped
        > out ILDASM and looked at BinaryReader::GetString and it defers
to a
        > protected method called BinaryReader::Read7BitEncodedInt which
seems to
        use
        > BinaryReader::ReadInt in two different forms to figure out if
it should
        read
        > it as a byte or a word.
        >
        > Like I said I don't have time to dissect the algorithm they
use to know
        when
        > it's a word vs. a byte, but hopefully this will send you down
the right
        > path.
        >
        > HTH,
        > Drew
        >
        > You can read messages from the DOTNET archive, unsubscribe
from DOTNET, or
        > subscribe to other DevelopMentor lists at
http://discuss.develop.com.
        >
        
        You can read messages from the DOTNET archive, unsubscribe from
DOTNET, or
        subscribe to other DevelopMentor lists at
http://discuss.develop.com.
        

(Ƨ杙,j~&93DM܆+޺{.n+93DN칻&޶-z++-aجr,uޖ\


Reply via email to