[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Binary Operation in Ruby

Vu Nang Luc

7/2/2007 8:19:00 AM

Dear all,

I've tried Ruby for some time. The language is pretty nice but now I
need some operations with binary data. I tried but I still can not
find out what to use?

What I really need is:
a = 3;
b = ~a;
c = a >>; ......
and some some class to handle an array of bytes.

I think the ability to manage binary data is vital for any languge,
can you tell me which functions to use?

Sincerely,

VN Luc

2 Answers

Tim Hunter

7/2/2007 2:20:00 PM

0

On Jul 2, 4:19 am, Vu Nang Luc <vunang...@yahoo.com> wrote:
> Dear all,
>
> I've tried Ruby for some time. The language is pretty nice but now I
> need some operations with binary data. I tried but I still can not
> find out what to use?
>
> What I really need is:
> a = 3;
> b = ~a;
> c = a >>; ......
> and some some class to handle an array of bytes.
>
> I think the ability to manage binary data is vital for any languge,
> can you tell me which functions to use?
>
> Sincerely,
>
> VNLuc

In Ruby we use the String class to hold bytes. Search this group's
archives for "binary file". Check out the Array#pack and String#unpack
methods.

Vu Nang Luc

7/3/2007 3:05:00 AM

0


rmagick@gmail.com vi t:
>
> In Ruby we use the String class to hold bytes. Search this group's
> archives for "binary file". Check out the Array#pack and String#unpack
> methods.

Thanks, that's quite useful.