Click here to Skip to main content
15,902,835 members
Home / Discussions / C#
   

C#

 
AnswerRe: Checking if a INT is NaN Pin
binglin13-Dec-05 13:44
binglin13-Dec-05 13:44 
AnswerRe: Checking if a INT is NaN Pin
Robert Rohde13-Dec-05 1:08
Robert Rohde13-Dec-05 1:08 
GeneralRe: Checking if a INT is NaN Pin
binglin13-Dec-05 13:46
binglin13-Dec-05 13:46 
GeneralRe: Checking if a INT is NaN Pin
Member 1512503031-May-21 5:51
Member 1512503031-May-21 5:51 
QuestionBinaryWriter.Write(string) Pin
Daniel Monzert13-Dec-05 0:05
Daniel Monzert13-Dec-05 0:05 
AnswerRe: BinaryWriter.Write(string) Pin
Ista13-Dec-05 2:33
Ista13-Dec-05 2:33 
AnswerRe: BinaryWriter.Write(string) Pin
Daniel Grunwald13-Dec-05 4:15
Daniel Grunwald13-Dec-05 4:15 
GeneralRe: BinaryWriter.Write(string) Pin
Daniel Monzert14-Dec-05 6:33
Daniel Monzert14-Dec-05 6:33 
For .NET users, they can simply use BinaryReader.ReadString(), that's correct. But I wanted to describe the file format for non-.NET users. I don't think they know a thing about it if I say "it's .NET prefixed". I haven't found any information on MSDN, too. Smile | :)

If I just write a 127 characters string, the hex code looks like:
7F 78 78 78 78... (where 78 is 'x'), 7F = 127

For 128 characters it's: 80 01 78 78 78 78... 80 = 128, 01 = ?.
For 256 characers it's: 80 02 78 78 78 78...
For 300 characters it's: AC 02 78 78 78 78...
For 512 characters it's: 80 04 78 78 78 78...
For 32768 characters it's: 80 80 02 78 78 78...

Now ok.. the 127 (and below) version looks quite simple.. but compared to the 128+ version, how can one determine if the second byte does not belong to the string but to the length prefix? I don't get the clue of this length prefixing thing Smile | :)

-- modified at 12:34 Wednesday 14th December, 2005

[quote]393: while (value >= 0x80) {
394: Write((byte) (value | 0x80));
395: value >>= 7;
396: }[/quote]
Hm so.. this means, while the byte value is >= 0x80 (128) there is a following byte, as long at it's value is < 0x80. But what about the 300 characters prefix? AC 02? AC is just 172 in decimal but the string length is 300.

-- modified at 12:38 Wednesday 14th December, 2005

Ah hell... wait... this prefix thing is very confusing. So.. AC means 0x80 + 0xAC = 300. Why needs that damn technique to be so complicated? Wink | ;)

It makes it even more difficult to describe the length prefix WTF | :WTF:
GeneralRe: BinaryWriter.Write(string) Pin
Daniel Grunwald14-Dec-05 6:40
Daniel Grunwald14-Dec-05 6:40 
QuestionPerfMon: Where are my counters? Pin
Salil Khedkar12-Dec-05 23:50
Salil Khedkar12-Dec-05 23:50 
AnswerRe: PerfMon: Where are my counters? Pin
S. Senthil Kumar13-Dec-05 1:06
S. Senthil Kumar13-Dec-05 1:06 
GeneralRe: PerfMon: Where are my counters? Pin
Salil Khedkar13-Dec-05 20:06
Salil Khedkar13-Dec-05 20:06 
QuestionC# And ADO.NET N-Tier Help Pin
systemnyc12-Dec-05 23:15
systemnyc12-Dec-05 23:15 
AnswerRe: C# And ADO.NET N-Tier Help Pin
Ista13-Dec-05 2:37
Ista13-Dec-05 2:37 
GeneralRe: C# And ADO.NET N-Tier Help Pin
systemnyc13-Dec-05 18:26
systemnyc13-Dec-05 18:26 
GeneralRe: C# And ADO.NET N-Tier Help Pin
Ista14-Dec-05 10:01
Ista14-Dec-05 10:01 
GeneralRe: C# And ADO.NET N-Tier Help Pin
systemnyc14-Dec-05 17:23
systemnyc14-Dec-05 17:23 
Questionusing Authorization Manager and principal permission Pin
keinan12-Dec-05 23:06
keinan12-Dec-05 23:06 
Questionhow to configure log4net for class library project Pin
YogeshChoudhary12-Dec-05 23:03
YogeshChoudhary12-Dec-05 23:03 
AnswerRe: how to configure log4net for class library project Pin
Anthony_Yio13-Dec-05 0:26
Anthony_Yio13-Dec-05 0:26 
GeneralRe: how to configure log4net for class library project Pin
YogeshChoudhary13-Dec-05 0:46
YogeshChoudhary13-Dec-05 0:46 
QuestionCrystal Reprt Pin
albCode12-Dec-05 22:56
albCode12-Dec-05 22:56 
AnswerRe: Crystal Reprt Pin
Polis Pilavas12-Dec-05 23:04
Polis Pilavas12-Dec-05 23:04 
Questionapplication pool getting recycled Pin
savage_12-Dec-05 22:49
savage_12-Dec-05 22:49 
QuestionWhat a character !! Pin
IceWater4212-Dec-05 22:10
IceWater4212-Dec-05 22:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.