From: Haoqi Haoqi Date: 2007-05-01T16:30:39+09:00 Subject: Re: sprintf can not work in ruby c source? Francis Cianfrocca wrote: > On 5/1/07, Haoqi Haoqi wrote: >> char *buf; >> sprintf(buf,"%s after %s",s1,s2); >> printf(buf); >> return Qnil; >> } >> void Init_hello(){ >> rb_define_global_function("tests",tests,0); >> } > > > > Um, you realize you're writing right into a random memory location? If > you're not an experienced C programmer, you may want to reconsider your > project to write a Ruby extension. I am not an experienced C programmer,and just learn to write a Ruby extension with c. -- Posted via http://www.ruby-forum.com/.