[xml] Possible bug with xmlBufferPtr object?
- From: Gilles Roy <groy qnx com>
- To: xml gnome org
- Subject: [xml] Possible bug with xmlBufferPtr object?
- Date: Thu, 29 Jan 2009 18:25:58 -0500
I'm trying to make a copy of an in memory XML buffer. Based on the
sample code on the website (testWriter.c, the testXmlwriterMemory
function) I want to copy it to a buffer instead of writing to a file.
However, what I tried was:
char *xmldata = malloc(buf->use);
memcpy(xmldata, buf->content, buf->use);
However, this doesn't quite work. If buf->content is a string "abcd"
buf->use will be 4. This doesn't count for any kind of string
terminator. Should it?
Or does the application have to add the string terminator itself?
Thanks,
Gilles`
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]