python zlib output to c++ string
I am trying to write the output of python zlib's output to a c++ string. The question is very similar to http://stackoverflow.com/questions/1618926/python-zlib-output-how-to-recover-out-of-mysql-utf-8-table here however, the difference is that my python script generates a C++ header file where the compressed data should be stored as a string. However, because of special characters and raw bytes I am unable to get C++ to read this as a string. The reason I cannot write it to a file and then it back in a c++ program is because this might be a driver component and hence reading files is not allowed. 
Here is a small example of what I am trying.
<pre><code>
compressed_string = zlib.compress("This is a huge string. Around 263KB")
fptr = open('my_header.h', 'w')

content = "#ifndef __HEADER_DEFS__\n\
#define __HEADER_DEFS__\n\
\n\
#include <string> \n\
\n\
std::string binary_compressed = \"%s\" \n\
\n\
#endif" % compressed_string

fptr.write(content)
fptr.close()
</code></pre>

However, the string I am compressing is a huge data, unlike the example I have given here and hence I am adding a screenshot to the kind of characters I am getting in the actual example. 

Please take a look at http://tinypic.com/r/1078lxw/7 for the screenshot.
Thanks


python zlib output to c++ string
===

I am trying to write the output of python zlib's output to a c++ string. The question is very similar to http://stackoverflow.com/questions/1618926/python-zlib-output-how-to-recover-out-of-mysql-utf-8-table here however, the difference is that my python script generates a C++ header file where the compressed data should be stored as a string. However, because of special characters and raw bytes I am unable to get C++ to read this as a string. The reason I cannot write it to a file and then it back in a c++ program is because this might be a driver component and hence reading files is not allowed. 
Here is a small example of what I am trying.
<pre><code>
compressed_string = zlib.compress("This is a huge string. Around 263KB")
fptr = open('my_header.h', 'w')

content = "#ifndef __HEADER_DEFS__\n\
#define __HEADER_DEFS__\n\
\n\
#include <string> \n\
\n\
std::string binary_compressed = \"%s\" \n\
\n\
#endif" % compressed_string

fptr.write(content)
fptr.close()
</code></pre>

However, the string I am compressing is a huge data, unlike the example I have given here and hence I am adding a screenshot to the kind of characters I am getting in the actual example. 

Please take a look at http://tinypic.com/r/1078lxw/7 for the screenshot.
Thanks

