> hey guys, any idea why my program would segfault whenever I try to use
> sprintf? example program I wrote to try and find my error:
>
> #include <stdio.h>
>
> int main()
> {
> char *string;
> char *string2;
>
> string = "blah";
>
> sprintf(string2, "%s is the string", string);
>
> printf("the string says %s", string2);
>
> return (0);
> }
>
> this segfaults, if i just use printf with string it works fine.. any
> input?
>
> -Justin
It's been a long time since I've done C programming, but don't you have to
allocate a sufficient amount of space for string2? You are writing into
never-never land the way it stands.
Daniel
---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]