Returning File Stream from C++ dll to Centura Team Developer

636 Views Asked by At

I found a C/C++ QRCode Library and want to use it as .dll. One function, simply called "qrcode" has char szSourceString[], char OUT_FILE[] as parameters. SourceString is the text to konvert and OUT_FILE is the filename. This function writes the .bmp.
In Gupta/Centura Team Developer 5.2, where I need to use the .dll, I need to pass those parameters as "LPSTR". Above mentioned works fine, but I'm looking for a way to return the filestream instead of writing the .bmp which I have to open in Centura again to process it further.

In the C++ library the file is written like this:

if (!(fopen_s(&f, OUT_FILE, "wb")))
        {
        fwrite(&kFileHeader, sizeof(BITMAPFILEHEADER), 1, f);
        fwrite(&kInfoHeader, sizeof(BITMAPINFOHEADER), 1, f);
        fwrite(pRGBData, sizeof(unsigned char), unDataBytes, f);

        fclose(f);

I want to return the unsigned char*pRGBData to where I call it from Centura. I don't have any idea how to do that/which datatype to use. I tried to convert pRGBData to std::string and return it but that crashes when calling the function from Centura. Idon't know if the converting itself would work ok or if it simply crashes because I chose the wrong datatype. As Centura-"String" I can pass "HARRAY HSTRING,LPSTRING, LPCSTR, LPCWSTR, LPVOID, LPWSTR". Could somebody help me here, please?

1

There are 1 best solutions below

0
On BEST ANSWER

Return it as a byte array und use Receive String LPCSTR in Gupta.