看了使用tinyxml的几个例子,如下void build_simple_doc( )
{
// Make xml: <?xml ..><Hello>World</Hello> TiXmlDocument doc;
TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );
TiXmlElement * element = new TiXmlElement( "Hello" );
TiXmlText * text = new TiXmlText( "World" );
element->LinkEndChild( text );
doc.LinkEndChild( decl );
doc.LinkEndChild( element );
doc.SaveFile( "madeByHand.xml" );
}发现很多new的都地方没有delete,我大致看了下tinyxml,好像没用智能指针啊,这样会不会内存泄露?
请用过TinyXML的兄弟解释下
{
// Make xml: <?xml ..><Hello>World</Hello> TiXmlDocument doc;
TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );
TiXmlElement * element = new TiXmlElement( "Hello" );
TiXmlText * text = new TiXmlText( "World" );
element->LinkEndChild( text );
doc.LinkEndChild( decl );
doc.LinkEndChild( element );
doc.SaveFile( "madeByHand.xml" );
}发现很多new的都地方没有delete,我大致看了下tinyxml,好像没用智能指针啊,这样会不会内存泄露?
请用过TinyXML的兄弟解释下
解决方案 »
- 类成员线程函数的设计和使用请教
- 很焦灼的socket数据丢失问题
- float和unsigned short
- 如何给CEditView的对象发信息
- 初学VC,请问VC中如何声明WINDWOSAPI?一般在什么位置?
- 使用SINK_ENTRY_INFO宏时的问题:怎么知道宿主程序的DISPID?
- 存档的时候该在OnFileSave()里写点什么?大家指点一下呀,急
- 1000000分求解,一定要高手才能解决的问题(低手勿入)
- 高分求打印代码,要求在A4的纸上打印一352*288的图,并显示一个标题,用vc
- 关于TreeView的问题。我老是无法取得当前选中节点的值。
- 使用VS2008写的MFC程序,如何生成可执行文件之后,在没有安装VS2008的机器上运行?
- VC MFC 对话框程序改变窗口大小
这个析构会消除所有资源的。
for(int i=0;i<no;i++) {
TiXmlElement* t_channel=new TiXmlElement("channel");
t_root->LinkEndChild(t_channel);
t_channel->SetAttribute("ID",i);
}