Posts

Using boost::property_tree

Image
Some short examples of how to use the Boost property tree in order to read from and write to XML files. Reading XML into a Boost property tree Here’s how to read an example XML into the Boost property tree and traverse each of the the “item” sections within this XML, given that items may contain differing subsections: For this XML example file "test1.xml" I use the following example XML taken from the Microsoft MSDN page :

Getting started with Spire.XLS for .NET

Image
E-iceblue Ltd . is a vendor of powerful components for .NET, Silverlight and WPF development. These products enable the user to easily read and write different formats of office files. A quick an easy guide to setting up Spire.XLS for use in Visual Studio .NET projects is presented here. For the purpose of clarity and helping the user get started as soon as possible, a simple 'HelloWorld' example is presented.

Using a subset of the boost libraries in Windows

Image
For many C++ applications I very much want to use the Boost libraries, just not the whole set. This post explains how to use the bcp tool to create a subset of the Boost libraries in order to leave out unnecessary libraries and tailor it to the needs of your project. One nice thing about bcp is that it can be run at any time so as to update your Boost dependencies as and when the need arises.

Converting a SYSTEMTIME to a std::string in C++

Image
A short recipe outlining how to output a SYSTEMTIME value as a std::string. The example format will be "YYYY-MM-DD HH:MM:SS.MMM" I specifically wanted to include milliseconds. In this example I employ three possible techniques: 1. MFC CString 2. std::ostringstream 3. sprintf

Using boost::filesystem

Image
Examples of using boost::filesystem for various things as and when I encounter them... Many have been lifted from the StackOverflow site. For reasons of brevity and clarity I generally avoid extraneous code such as exception handling etc in these examples and just focus on the techniques themselves. Shortcuts to examples covered in this boost file system tutorial are as follows: 1. Copying a directory 2. Iterating over files in a directory 3. Recursively search for a file within a directory and its subdirectories 4. Counting the number of files in a directory 5. Find out when a file was last modified 6. Rename a file 7. To remove a file or directory 8. To create a directory 9. Obtaining relative paths 10. Recursively find/delete all files in a directory 1. Copying a directory This recursively uses boost::filesystem::create_directory to create a copy of a directory including its contents, sub-directories etc. For example the MyStuff folder: Use the followi...

Getting Started with TinyXml

Image
Step 1: Download and install TinyXML Download and extract the library from http://www.grinninglizard.com/tinyxml/ TinyXML source files as shown:

An editable MFC List Control

Image
A run-through on how to create a editable MFC List Control by making the CListCtrl editable. Visual Studio 2010 project downloadable from here . Much of the credit for this must go to Zafir Anjum on the Codeguru site for an article called "Editable subitems" from which this post borrows quite heavily.