Project

General

Profile

Actions

Support #1444

open

how to save a binary file of the postgres database to a file on disk

Added by Marcio Sales over 11 years ago. Updated over 11 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
09/24/2012
Due date:
% Done:

0%

Estimated time:

Description

how to save a binary file of the postgres database to a file on disk

Actions #1

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.

Actions #2

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

Actions #3

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.

Actions #4

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

Actions #5

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();
Actions #6

Updated by Marcio Sales over 11 years ago

thank you very much

Actions #7

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

Actions #8

Updated by Marcio Sales over 11 years ago

solved

wmr->setData(outData.getData(),outData.getSize());

Actions

Also available in: Atom PDF