From: Akif Tokuz Date: 2007-08-22T20:07:10+09:00 Subject: Re: reading byte stream from network unknown wrote: > Yeah, look at String#reverse in conjuction w/ unpack. One of the > coolest and most confusing aspects of ruby (for me as a C programmer > anyway) is the equivalence between strings and unstructured binary. > It's confusing b/c buffers of characters in C in a way have "duck > typing" as you usually read them in as an unsigned char *. Usually > with OO languages other than ruby, you have to go through some madness > to get unstructured data into a string, or vice versa. I didnt think it would work in the first run. But hell it worked! You should have seen the faces of my friend when i showed them this single line is actually equal to that ^+%+%&^+%^+ lines of C code:=) Respect... def processTrackDataMessage(message) trackDataMsg=message.unpack('SIS3D2CDSDSDSDS3A6S36DS10D4S2ISA36A12A16IS2A36A12A36A12') end Thanks for the tip guys. Akif, -- Posted via http://www.ruby-forum.com/.