From: Brian Candler Date: 2009-11-20T18:20:30+09:00 Subject: Re: Error: symbol string may not contain `\0' Dylan Lukes wrote: > Basically it's pretty self explanatory. I'm packing the following: > > [0x00, 0x07, str1, str2, 0x00].pack(cA64A64c) Please show the *exact* code you are running, and the *exact* error you are getting (use copy-paste for both), because what you have posted doesn't make any sense and I cannot replicate the particular error you claim to see. >> [0x00, 0x07, str1, str2, 0x00].pack(cA64A64c) NameError: undefined local variable or method `str1' for main:Object from (irb):1 >> str1 = "abc"; str2 = "def" => "def" >> [0x00, 0x07, str1, str2, 0x00].pack(cA64A64c) NameError: undefined local variable or method `cA64A64c' for main:Object from (irb):3 from :0 >> [0x00, 0x07, str1, str2, 0x00].pack("cA64A64c") TypeError: can't convert Fixnum into String from (irb):4:in `pack' from (irb):4 from :0 >> [0x00, 0x07, str1, str2, 0x00].pack("ccA64A64c") => "\000\aabc def \000" >> [0x00, 0x07, str1, str2, 0x00].pack("ccA64A64c") => "\000\aabc\000 def \000" >> After removing the obvious bugs from your code it looks fine to me, so if this doesn't do what you want, you'll have to explain what it is you are trying to do. -- Posted via http://www.ruby-forum.com/.