我正在尝试在 Visual Studio 2017 上编写 Xml 程序,但出现错误:
using System.Xml;
...
XmlWriter.Create("C:\\myxmlfile.xml", settings);
Run Code Online (Sandbox Code Playgroud)
有了这个消息:The type name 'Create' doesn't exist in the type XmlWriter.
我怀疑我的 Visual Studio 的不完整安装(不幸的是尚未修复)导致了此问题。我该如何修复它?
为什么,当我使用下面的代码片段的结果是零,无论文件大小,但是当我删除ios::binary在open()它做什么,它应该做的?
fstream f1;
streampos begin, end;
f1.open("file1", ios::binary);
f1.seekg(0, ios::beg);
begin = f1.tellg();
f1.seekg(0, ios::end);
end = f1.tellg();
f1.close();
cout << end - begin << endl;
Run Code Online (Sandbox Code Playgroud)