[쥬니] 전환점

블로그 이미지
시작!
by eiliyuki
  • 9,028Total hit
  • 0Today hit
  • 1Yesterday hit



1. Load
TiXmlDocument doc(FILE_PATH);
doc.LoadFile();

TiXmlDocument m_XmlDoc;
if( m_XmlDoc.LoadFile(FILE_PATH) == true )
AfxMessageBox(_T("Load 성공"));


2. 값 추출??
TiXmlNode *node = doc.FirstChild("QuestList")->FirstChild("QuestIndex");
TiXmlElement *element = NULL;

while(node != NULL)
{
element = node->ToElement();
if(!element)
continue;
TCHAR buffer[256] = {0,};
const char *sCharBuffer = element->Attribute("name");


MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, sCharBuffer, strlen(sCharBuffer), buffer, 256);
((CMainFrame*)m_pMainWnd)->FillFileView(buffer);
node = node->NextSibling();
}

<?xml version="1.0" encoding="euc-kr" ?>
<QuestList>
<QuestIndex index="1" name="quest_alice"/>
<QuestIndex index="2" name="quest_zoo"/>
<QuestIndex index="3" name="quest_flower"/>
<QuestIndex index="4" name="quest_candy"/>
</QuestList>

3. xml 파일로 저장
TiXmlDocument doc;
TiXmlDeclaration *decl = new TiXmlDeclaration("1.0", "utf-8", "");
doc.LinkEndChild(decl);

TiXmlElement *root = new TiXmlElement("QuestList");
doc.LinkEndChild(root);

for(int i = 0; i < 5; i++)
{
TiXmlElement *index = new TiXmlElement("QuestIndex");
root->LinkEndChild( index );
char sIndex[10];
sprintf_s(sIndex, "%d", i);
index->SetAttribute("index", sIndex);
strcpy_s(sIndex, "hi");
index->SetAttribute("name", sIndex);
}

doc.SaveFile("xml/test.xml");



<?xml version="1.0" encoding="utf-8" ?>
<QuestList>
<QuestIndex index="0" name="hi" />
<QuestIndex index="1" name="hi" />
<QuestIndex index="2" name="hi" />
<QuestIndex index="3" name="hi" />
<QuestIndex index="4" name="hi" />
</QuestList>


TRACKBACK 0 AND COMMENT 0

http://imnews.imbc.com/replay/nwdesk/article/2145580_2687.html

한낮에도 일어나는 이런 무서운 사건들,,
무서워서 어떻게 살아야 하는건지..



http://news.naver.com/main/read.nhn?mode=LSD&mid=sec&sid1=102&oid=001&aid=0002023668 -> cctv 원본

TRACKBACK 0 AND COMMENT 2

회사,, 일,,,
나의 일상,, 생활,,,업무..
가족, 친구,,동료 그리고 연인..


시간은 나를 초월해 가고.....
그만큼 생각이 늘어나는 듯.....
나이도... 늘어가네.. 요런젠좡-_-;;

TRACKBACK 0 AND COMMENT 1

ARTICLE CATEGORY

분류 전체보기 (14)
쥬니 이야기 (7)
게임 프로그래밍 (7)

RECENT TRACKBACK

CALENDAR

«   2019/08   »
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

ARCHIVE