On 06/29/2010 10:05 PM, Michael Torrie wrote:
> #include <stdio.h>
> 
> int main(int argc, char ** argv)
> {
>       char *buf = malloc(512 * sizeof(char));
>       const int a = 2, b = 3;
>       snprintf(&buf, sizeof buf, "%d + %d = %d\n", a, b, a + b);
                       ^^^^^^^^^^
Make that 512*sizeof(buf)

Still segfaults though.

>       fprintf(stdout, buf);
>       free(buf);
>       return 0;
> } /*main*/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to