对不起这个新手问题。
我在win7中使用visual studio ultimate。 目前正在尝试读取XML文件。我的xml文件位置是C:\ Users \ Sael \ Documents \ Visual Studio 2013 \ Projects \ Hotel_Management \ Debug \ temp \ app.xml。
但是当我调试app.exe时,我收到此消息'找不到文件C:\ Users \ Sael \ Documents \ Visual Studio 2013 \ Projects \ Hotel_Management \ Debug \ temp \ app.xml' 实际上我的xml文件是存在的。有人可以帮忙吗?
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::IO;
using namespace System::Xml;
...
XmlDocument ^ docVideo = gcnew XmlDocument;
String ^ strFilename = L"C:\Users\Sael\Documents\Visual Studio 2013\Projects\Hotel_Management\Debug\temp\app.xml";
if (File::Exists(strFilename))
{
char *path = NULL;
size_t size;
path = getcwd(path, size);
MessageBox(NULL, pwd, pwd, 0);
docVideo->Load(strFilename);
XmlElement ^ elm = docVideo->DocumentElement;
XmlNodeList ^ lstVideos = elm->ChildNodes;
MessageBox::Show("The root element contains " +
lstVideos->Count + L" nodes");
//txtDocument->Text = elm->InnerText;
}
else
MessageBox::Show(L"The file " + strFilename + L" was not found");