Access to sheet by name

This example shows how to access to sheet by name instead by index.

#include "libxl.h"
#include <iostream>

using namespace libxl;

Sheet* getSheetByName(Book* book, const wchar_t* name)
{
   for(unsigned short i = 0; i < book->sheetCount(); ++i)
   {
       if(wcscmp(book->getSheet(i)->name(), name) == 0)
       {
           return book->getSheet(i);
       }
   }
   return 0;
}

int main() 
{
    Book* book = xlCreateBook();  

    if(book->load(L"input.xls"))
    {
        Sheet* sheet = getSheetByName(book, L"Sheet2");
        if(sheet)
        {
            double d = sheet->readNum(2, 2);
            std::cout << d << std::endl;
        }
        else
        {
            std::cout << "Sheet not found" << std::endl;
        }
    }
 
    book->release();

    return 0;
}