Writing to memory buffer

This example shows how to write an Excel spreadsheet into memory buffer.
#include "libxl.h"
#include <fstream>

using namespace libxl;

int main() 
{   
    Book* book = xlCreateBook();
    Sheet* sheet = book->addSheet(L"Sheet1");
    
    const char* data;
    unsigned size;

    if(book->saveRaw(&data, &size))
    {
        std::fstream stream("output.xls", std::ios_base::out | std::ios_base::binary);
        stream.write(data, size);
    }

    book->release();
  
    return 0;
}