Aspose.Cells c++ license check

Hello!
Help is needed.
I am checking C++ QT license. I read the license in buffer.
I need to transfer data from buffer (or array) to m_string stream.
Code:
intrusive_ptr license = new License();
QFile file(":/aspose_license/Aspose.Total.C++.lic");
if( file.open(QIODevice::ReadOnly) )
{
auto data = file.readAll();
const unsigned char* begin = reinterpret_cast<unsigned char*>( data.data() );
const unsigned char* end = begin + data.length();
std::vector buffer( begin, end );
System::ArrayPtr<uint8_t> array( new System::Array<uint8_t>( buffer ) );

    intrusive_ptr<Aspose::Cells::Systems::IO::Stream> m_string;  // write from buffe 

    license->SetLicense( m_string );

@PiterG,
For now, we support to apply license using file or stream Object. You can refer to the documentation for loading and using the License.

My license is not stored in a file, but in a resource (QT). I did a license check from the file. I need to read from a resource. To do this, I read into the buffer. I need to put from buffer into Asposa stream. In this case, I do not post the license file in the public domain

For Aspose.Words I did
auto ms = System::MakeObject System::IO::MemoryStream ( array );
lic->SetLicense( ms );

@PiterG
Because we have different data types with Aspose.Words,I suggest you do like this

intrusive_ptr<BString> buffer = new BString(your array count);
for (int i = 0; i < buffer->GetCount(); i++)
{
	buffer->SetValue(your array(i), i);
}
MemoryStreamPtr ms = new MemoryStream(buffer);
license->SetLicense(ms);

Hope helps a bit.

Thank you. For the Aspose.Words library, it works for me. For Aspose.Cells, I tried to write byte by byte. I have bytes in the buffer. But what didn’t work. I’ll try to implement a cyclic record again.Thank you. For the Aspose.Words library, it works for me. For Aspose.Cells, I tried to write byte by byte. I have bytes in the buffer. But what didn’t work. I’ll try to implement a cyclic record again.
Problem intrusive_ptrAspose::Cells::Systems::IO::Stream m_string = …; // write from buffe

I implemented check for 4 libraries. Weighs 3 more)
Thanks again

The forum editor does not see brackets less than - more!!!

Thank you. The hint helped. Before that, I wrote byte-by-byte in a loop, but a little different. Nice Aspose library. I have evaluated many libraries. Convinced to buy Aspose. It’s bad that there are few examples, and the code is closed in dll. It is impossible to look at the source code when a problem occurs. I post a working solution, maybe it will help someone.

 intrusive_ptr<License>license = new License();
QFile file(":/aspose_license/Aspose.Total.C++.lic");
if( file.open(QIODevice::ReadOnly) )
{
    auto data = file.readAll();
    const unsigned char* begin = reinterpret_cast<unsigned char*>( data.data() );
    const unsigned char* end = begin + data.length();
    std::vector<unsigned char> buffer( begin, end );
    System::ArrayPtr<uint8_t> array( new System::Array<uint8_t>( buffer ) );
    auto ms = System::MakeObject<System::IO::MemoryStream>( array );
    try
    {
        intrusive_ptr<BString> buf = new BString (buffer.size());
        for( int i=0; i < buffer.size(); i++ )
           buf->SetValue( buffer[i], i );
       StreamPtr ms = new MemoryStream( buf );
      license->SetLicense( ms );
    }

@PiterG,

Thanks for considering Aspose and sharing working sample.

It is nice to know that your issue is sorted out. Surely, your code snippet might help other users.