I want to read file via stdio for RapidXML. I used following:
#include <iostream>
#include <rapidxml.hpp>
#include <stdio.h>
#include <Windows.h>
using namespace rapidxml;
int main(int argc, char** argv)
{
    FILE *pFile;
    pFile = fopen("D:\\ColladaFiles\\sample1.dae", "rb");
    long lSize;
    char *buffer;
    size_t result;
    //if error
    if (pFile == NULL) { fputs("File error", stderr); exit(1); }
    // obtain file size:
    fseek(pFile, 0, SEEK_END);
    lSize = ftell(pFile);
    rewind(pFile);
    // allocate memory to contain the whole file:
    buffer = (char*)malloc(sizeof(char)*lSize);
    if (buffer == NULL) { fputs("Memory error", stderr); exit(2); }
    // copy the file into the buffer:
    result = fread(buffer, 1, lSize, pFile);
    if (result != lSize) { fputs("Reading error", stderr); exit(3); }
    /* the whole file is now loaded in the memory buffer. */
    xml_document<> xdoc;
    xdoc.parse<0>(buffer);
    system("pause");
    return 0;
}
RapidXML generated an error. Because If I write buffer following:
std::cout << buffer << std::endl;
Last line is contains a following:
 How do fast read a file for RapidXML?
How do fast read a file for RapidXML?
 
     
     
     
    