Exception when loading a Workbook in a loop

For testing purposes, I tried to open the same workbook up to 1000 times in a row.
After exactly 100 loops, the code starts to bump into a cryptic CellsException on every execution.

int main()
{
  intrusive_ptr<IWorkbook> wb;

  // open workbook
  StringPtr dirPath = new String("C:\\Temp\\");
  try
  {
    for (int i = 1; i <= 1000; i++)
    {
      wb = Factory::CreateIWorkbook(dirPath->StringAppend(new String("input.xlsx")));
      std::cout << "Create (" << i << ")" << std::endl;
    }
  }
  catch (CellsException exc)
  {
    std::cout << "CellsException" << std::endl;
  }
  catch (Exception exc)
  {
    std::cout << "Exception" << std::endl;
  }

  return 0;
}

I have tried with XLSX and XLSM files.

Inner exception message:
“You are using an evaluation copy and have opened files exceeding limitation.”

No support required, then.

@tpo,

Yes, the exception is expected as in evaluation mode (without using a valid license to be set in code), you cannot open more than 100 workbooks at a time. So, for your task you need to have a valid license and set it in code before using other Aspose.Cells for C++ APIs at the start. See the document on licensing.

PS. you can also request a 30 days temporary license here.