Re: [xml] sprintf and xmlChar



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

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

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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