Re: [xml] sprintf and xmlChar

On Mon, Aug 26, 2002 at 10:31:48PM +0200, Christian Stocker wrote:

Quick Question:

Can something go awry, if i do the following:

xmlChar *value, *string;
value = (xmlChar*) malloc (sizeof(xmlChar *) * (xmlStrlen(string) + 3));
sprintf(value, "\"%s\"", string);

or is there a better way of surrounding a xmlChar with " and " (or any
other character...). And can I use sprintf for xmlChar? Maybe I didn't see
something obvious, which would forbid that...

  Sounds fine, I would use snprintf anyway ...


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]