summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-02-28 06:01:13 +0000
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-02-28 06:01:13 +0000
commit6305ac11a88f4bd2ee9cbbabe8e71aaff075010e (patch)
tree846f6820a02d2200286a0aae607b986338d6e03f
parente33e1083ad703ed8ab0748ad05256cc5a4907efc (diff)
docs: Fix samples compilation
git-svn-id: https://pugixml.googlecode.com/svn/trunk@992 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--docs/samples/load_memory.cpp1
-rw-r--r--docs/samples/save_custom_writer.cpp12
2 files changed, 7 insertions, 6 deletions
diff --git a/docs/samples/load_memory.cpp b/docs/samples/load_memory.cpp
index 365fb64..1185944 100644
--- a/docs/samples/load_memory.cpp
+++ b/docs/samples/load_memory.cpp
@@ -1,6 +1,7 @@
#include "pugixml.hpp"
#include <iostream>
+#include <cstring>
int main()
{
diff --git a/docs/samples/save_custom_writer.cpp b/docs/samples/save_custom_writer.cpp
index defcb33..6ea4300 100644
--- a/docs/samples/save_custom_writer.cpp
+++ b/docs/samples/save_custom_writer.cpp
@@ -1,8 +1,8 @@
#include "pugixml.hpp"
#include <string>
-
-#include <stdio.h>
+#include <iostream>
+#include <cstring>
//[code_save_custom_writer
struct xml_string_writer: pugi::xml_writer
@@ -97,19 +97,19 @@ int main()
doc.load("<foo bar='baz'>hey</foo>");
// get contents as std::string (single pass)
- printf("contents: [%s]\n", node_to_string(doc).c_str());
+ std::cout << "contents: [" << node_to_string(doc) << "]\n";
// get contents into fixed-size buffer (single pass)
char large_buf[128];
- printf("contents: [%s]\n", node_to_buffer(doc, large_buf, sizeof(large_buf)));
+ std::cout << "contents: [" << node_to_buffer(doc, large_buf, sizeof(large_buf)) << "]\n";
// get contents into fixed-size buffer (single pass, shows truncating behavior)
char small_buf[22];
- printf("contents: [%s]\n", node_to_buffer(doc, small_buf, sizeof(small_buf)));
+ std::cout << "contents: [" << node_to_buffer(doc, small_buf, sizeof(small_buf)) << "]\n";
// get contents into heap-allocated buffer (two passes)
char* heap_buf = node_to_buffer_heap(doc);
- printf("contents: [%s]\n", heap_buf);
+ std::cout << "contents: [" << heap_buf << "]\n";
delete[] heap_buf;
}