Support #1444
openhow to save a binary file of the postgres database to a file on disk
0%
Description
how to save a binary file of the postgres database to a file on disk
Updated by Wim Dumon over 11 years ago
- Status changed from New to Feedback
could you elaborate more in detail what you want to do?
BR,
Wim.
Updated by Marcio Sales over 11 years ago
I need to save a binary field (record of table) of the postgres database to a file on disk
this field declared as std::vector
Updated by Wim Dumon over 11 years ago
Marcio,
I propose something like:
std::ofstream outfile("filename.bin", std::ios::out | std::ios::binary);
outfile.write(&v[0], v.size());
outfile.close();
BR,
wim.
Updated by Marcio Sales over 11 years ago
Wim,
thanks for the help but error occurred
erro: invalid conversion from 'const unsigned char*' to 'const char*' [-fpermissive]
Márcio
Updated by Wim Dumon over 11 years ago
std::ofstream outfile("filename.bin", std::ios::out | std::ios::binary);
outfile.write((const char*)&v[0], v.size());
outfile.close();
Updated by Marcio Sales over 11 years ago
Hi Wim,
I need more help.
this is a file zip and i need to get a one file of this zip, to show in component WMemoryResource
I got inflate the zip and get the file this is the code.
zip.OpenFromMemory((const char*)&attachment~~binarydata[0], attachment~~>binarydata.size());
after i got the file
CkZipEntry *entry = zip.FirstEntry();
and then i inflate
entry->Inflate(*outData);
and the problem is
wmr.setData(*outData->getData());
message: request for member 'setData' in 'wmr', which is of non-class type
Updated by Marcio Sales over 11 years ago
solved
wmr->setData(outData.getData(),outData.getSize());