Hey there

I am writing an MFC app in Visual Studio 2012 that will open a JPG file as binary and read all the contents to a CString.

I am able to read it to a std::Vector, but that doesn't help me much as i need to pass all the binary content as a MFC CString to another function.

Can anyone help me with a sample code for that?

Thanks in advance

More Update:

Let me explain the problem a little more deeper.

I am trying to call a JavaScript (JS) function in a HTML page and then want to pass the binary date. The C++ function that calls the JS is given below.

bool CallJavaScript(const CString strFunc,CComVariant* pVarResult);

The 1st argument is the JS Function Name and 2nd is the one to pass the Binary Data. 1st argument works fine as i am able to call the JS fucntion called "LoadImage" without any problem. Problem is with 2nd argument that's supposed to take the Binary data of the JPG file.

If i try to pass a std::Vector or std::string then it will give me an error.

But it's happy if i pass CString. But then with CString there's a problem with NULL characters.

Actually my plan is to pass the binary of a JPG to a JS function and let it display the JPG in the HTML page.

Is there a better way of doing this?

Can i typecast a Vector or std::string to a CComVariant*?

Please help. Thanks