{
IXMLDOMDocumentPtr pXMLDom;
tempDatabase.init("ZHUIYI","Report","","");//连接数据库
CreateDirectory("C:\\Rport",NULL);
time_t t;
t = time(NULL);
char tempBuildTime[32];
strftime(tempBuildTime, sizeof(tempBuildTime),"%Y-%m-%d %H:%M:%S", localtime(&t));
char tempPath[32];
sprintf(tempPath,"C:\\Report\\%s.htm",m_filename);
temp.SaveReportFilesInfo(m_filename,tempPath,tempBuildTime,m_description);//保存数据
hr = pXMLDom->save(_variant_t(&tempPath));
if (FAILED(hr))
{
printf("Save Failed \n");
}
else
{
printf("Save Successful\n");
}
if (pXMLDom) pXMLDom.Release();
}
运行的警告:
warning C4305: 'argument' : truncation from 'char (*)[32]' to 'bool'
warning C4800: 'char (*)[32]' : forcing value to bool 'true' or 'false' (performance warning)
问题是没有在C:\Report文件夹下生成任何文件,如果换成hr = pXMLDom->save("C:\\Report\\chart.htm");(没有任何警告)便可以在C:\Report下生成chart.htm。这是为什么啊?希望各位解答
/*************************************************************************************************************************/
save方法的原型:
inline HRESULT MSXML2::IXMLDOMDocument::save ( const _variant_t & destination ) {
HRESULT _hr = raw_save(destination);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
[此贴子已经被作者于2006-5-25 13:33:56编辑过]