Click here to Skip to main content
15,881,568 members
Articles / Desktop Programming / MFC

A simple XML Parser

Rate me:
Please Sign up or sign in to vote.
4.69/5 (13 votes)
28 Jan 2002CPOL 361.2K   5.8K   70  
A class to read and write non validated XML files
// stdafx.cpp : source file that includes just the standard includes
//	Dir.pch will be the pre-compiled header
//	stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

long GetHeapSize()
{
   DWORD    blocks = 0;
   HANDLE   snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPHEAPLIST, 0);
   
   if (((int) snapshot) != -1) { 
      HEAPLIST32   hl = {sizeof(hl)};
      HEAPENTRY32  he;

      for (BOOL fOKHL = Heap32ListFirst(snapshot, &hl); fOKHL; 
           fOKHL = Heap32ListNext(snapshot, &hl)) 
      {
         memset(&he, 0, sizeof(he));
         he.dwSize = sizeof(he);

         BOOL fOKHE = Heap32First(&he, 0, hl.th32HeapID);
      
         for (; fOKHE; fOKHE = Heap32Next(&he)) 
         {
            if ((he.dwFlags & LF32_FREE) == 0) 
            {
               blocks += he.dwBlockSize;
            }
         }
      }

      CloseHandle(snapshot);
   }

   return blocks;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Retired
United States United States
Began programming in 1968 on a Wang 720. Move to Fortran and began developing FEM (finite element model) applications on an IBM 360 in 1973. Developed custom FEM editors for most of my career until 1995.

Comments and Discussions