From: Haoqi Haoqi Date: 2007-05-01T16:32:59+09:00 Subject: Re: sprintf can not work in ruby c source? Maik Schmidt wrote: > In article <9d71df8a63af2a669698ea94c2a5111c@ruby-forum.com> Haoqi > Haoqi wrote: > >> sprintf(buf,"%s after %s",s1,s2); >> printf(buf); >> return Qnil; >> } >> void Init_hello(){ >> rb_define_global_function("tests",tests,0); >> } >> > I guess your problem is that buf is an uninitialized pointer pointing to > an > arbitrary memory location. If you declare it like this > char buf[200] > your program should work. Oh,Yes,Thank you very much!~ C:\ext\1>ruby client.rb a after b ^_^ -- Posted via http://www.ruby-forum.com/.