[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Trouble with Marshal

Gavin Kistner

10/26/2006 9:51:00 PM

From: Gavin Kistner
> p s2 = Marshal.load( IO.read( 'desc.marshal' ) )
>
> #=> foo.rb:13:in `load': marshal data too short (ArgumentError)

Bah, my stupid fault. It was binary mode at stake, but on reading, not writing. Mauricio Fernández kindly pointed out my error. Changing the above to...
File.open( 'desc.marshal', 'rb' ){ |f| @s2 = Marshal.load( f.read ) }
...fixed my problem.

Thanks for the help, sorry for the noise.