cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: write callback issues (was Re: A new problem)

From: Linus Nielsen Feltzing <linus_at_haxx.se>
Date: Thu, 10 Apr 2008 09:26:01 +0200

Prasad J Pandit wrote:
> char msg[1024];
> ...
> _snprintf (msg, sizeof (msg), "%02X", (*(Curldata **)usrp)->data));

Ouch! That's not the right way to do it. Here's a better way:

    char msg[1024];
    int i;
    ...
    for(i = 0;i < [length-of-data];i++) {
       _snprintf (&msg[i*2], sizeof (msg)-i*2-1, "%02X", (*(Curldata
**)usrp)->data[i]));
    }

Linus
Received on 2008-04-10