cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: getinmemory.c sample crashes with TCHAR

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Mon, 13 Nov 2006 11:12:32 -0600

> What do you suggest? Having this line look like this:

> memcpy(&(mem->memory[mem->size * sizeof(TCHAR)]), ptr, realsize *
> sizeof(TCHAR));

No, I would suggest having a line that looks like this:

char *memory;

Libcurl reads and writes in bytes, and AFAIK there is no guarantee
that it will always pass
complete multi-byte chars to your callback. So I think it is much
easier to use a single-byte
index for your buffer, and typecast/convert the buffer to multibyte when needed.

 - Jeff
Received on 2006-11-13