Created
August 6, 2013 15:55
-
-
Save hirosof/6165814 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define WIN32_LEAN_AND_MEAN | |
| #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS | |
| #include <atlbase.h> // CComPtrを使用するため | |
| #include <xmllite.h> | |
| #pragma comment(lib, "xmllite.lib") | |
| #include <stdio.h> | |
| #include <Windows.h> | |
| #include <windowsx.h> | |
| int main(void){ | |
| CComPtr<IXmlWriter> pWriter; | |
| CComPtr<IStream> pStream; | |
| SHCreateStreamOnFile(_T("xmllite_write.xml") , STGM_READWRITE | STGM_CREATE , &pStream); | |
| CreateXmlWriter(__uuidof(IXmlWriter) , reinterpret_cast<void**>(&pWriter) , 0); | |
| pWriter->SetOutput(pStream); | |
| pWriter->SetProperty(XmlWriterProperty_Indent , TRUE); | |
| pWriter->WriteStartDocument(XmlStandalone_Yes); | |
| pWriter->WriteStartElement(NULL, L"test" , NULL); | |
| { | |
| pWriter->WriteStartElement(NULL , L"indata" , NULL); | |
| pWriter->WriteString(L"文字列"); | |
| pWriter->WriteEndElement(); | |
| } | |
| pWriter->WriteEndElement(); | |
| pWriter->WriteEndDocument(); | |
| pWriter->Flush(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment