[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: sprintf can not work in ruby c source?

seebs

5/1/2007 7:37:00 AM

In message <9d71df8a63af2a669698ea94c2a5111c@ruby-forum.com>, Haoqi Haoqi writes:
>here is my simple test:
>where is my mistake??

>#include "ruby.h"
>#include "stdio.h"
>static VALUE
>tests(){
> char *s1="a ";
> char *s2=" b";
> char *buf;
> sprintf(buf,"%s after %s",s1,s2);

Right about here.

"buf" is a pointer.

Where, exactly, do you think it points? Have you told the compiler to point
it AT anything?

-s