[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Reading binary file written by C program

Paul Stickney

3/22/2007 7:37:00 PM

I would start here:
http://raa.ruby-lang.org/search.rhtml?sea...
(Also, check on rubyforge.org)

You might want to look at Array#pack and String#unpack.
Also, make sure to open up the file as binary!

Enjoy.

On 3/22/07, Yacao Wang <yacaowang@gmail.com> wrote:
> Hi all,
>
> I've learned some basic of Ruby and I need to write a program that can read
> data from binary files written by a C program. I was supposed to use the
> company library to do this using C++ but I really feel that this job could
> be done more quickly with the advanced features of Ruby. The binary files
> are generally directly dumped by C structs. Is there a "ruby way" of doing
> this? Thanks in advance.
>
> --
> Alex
>

4 Answers

Patrick Hurley

3/22/2007 9:02:00 PM

0

On 3/22/07, Paul Stickney <pstickne@gmail.com> wrote:
> I would start here:
> http://raa.ruby-lang.org/search.rhtml?sea...
> (Also, check on rubyforge.org)
>

in there you will see the binary-parse gem, I wrote it to do exactly
what you are describing for my own needs.

pth

Seon

2/4/2009 7:13:00 AM

0



"Sir John Howard" <sirjohnhoward@gmail.con> wrote in message
news:0199322b$0$17208$c3e8da3@news.astraweb.com...
> Seon Ferguson wrote:
>> I think that's horrible I also believe Christians should have the right
>> to practice their religion without being persecuted.
>
> Too bad its illegal in Soddy Barbaria.
>
Yeah the whole country is a dictatorship. Its worse than Iran.

Government Shill #2

2/4/2009 4:35:00 PM

0

On Wed, 4 Feb 2009 18:13:11 +1100, "Seon Ferguson" <seongf@gmail.com>
wrote:

>
>
>"Sir John Howard" <sirjohnhoward@gmail.con> wrote in message
>news:0199322b$0$17208$c3e8da3@news.astraweb.com...
>> Seon Ferguson wrote:
>>> I think that's horrible I also believe Christians should have the right
>>> to practice their religion without being persecuted.
>>
>> Too bad its illegal in Soddy Barbaria.
>>
>Yeah the whole country is a dictatorship.


No. It's a monarchy.

https://www.cia.gov/library/publications/the-world-factbook/geos/sa...


>Its worse than Iran.


More cloudy? Hotter? Sandier? Too flat? What is worse in Saudi than Iran?

--
Shill #2

I am not young enough to know everything.
Oscar Wilde (1854 - 1900)

Seon

2/4/2009 11:06:00 PM

0



"Government Shill #2" <gov.shill@gmail.com> wrote in message
news:3pgjo4p25k3gk3l6ijlt60ipk93ivjv3kf@4ax.com...
> On Wed, 4 Feb 2009 18:13:11 +1100, "Seon Ferguson" <seongf@gmail.com>
> wrote:
>
>>
>>
>>"Sir John Howard" <sirjohnhoward@gmail.con> wrote in message
>>news:0199322b$0$17208$c3e8da3@news.astraweb.com...
>>> Seon Ferguson wrote:
>>>> I think that's horrible I also believe Christians should have the right
>>>> to practice their religion without being persecuted.
>>>
>>> Too bad its illegal in Soddy Barbaria.
>>>
>>Yeah the whole country is a dictatorship.
>
>
> No. It's a monarchy.
>
Remember how England used to be before the civil war and it ruled using the
church of England and Catholics got persecuted? Ok even you are probably to
young to remember that. My point is monarchy's using religion to control its
people are always bad news.

> https://www.cia.gov/library/publications/the-world-factbook/geos/sa...
>
>
>>Its worse than Iran.
>
>
> More cloudy? Hotter? Sandier? Too flat? What is worse in Saudi than Iran?
>
> --
Civil rights. Apart from the Bahai's of course but are they any cases of
Christians being persecuted or killed in Iran?

> Shill #2
>
> I am not young enough to know everything.
> Oscar Wilde (1854 - 1900)