0

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?

  • Your question is unclear, do you want to return a file stream or whatever `pRGBData` points to? – user657267 Jul 30 '14 at 08:56
  • Reading your text you don't want the *file stream*, you want the *raw image data*. Also note that even if you manage to get it, it has already been written to the file, so if you want to process the image data and then write it to the file you have to either rewrite the data at the correct position, including possible modifications to the headers, or rewriting the code of the library to not write to file, but instead have a function which creates the data and gives it back to you, and a separate function which actually writes the data to file. – Some programmer dude Jul 30 '14 at 09:02
  • Sorry for the unclear question. I want the _image data_. I can rewrite the code so it gives me back the data without writing it. My problem is, that I don't know how to return it. Can I write something simple like `return pRGBData` ? But what datatype do I have to use on the Centura side, then? – user3884424 Jul 30 '14 at 09:33

1 Answers1

2

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