Hi folks,
I want to use sqlite_encode_binary to encode zip files into sqlite databse. But
somehow I don't get the wanted result of this procedure.
Can someone tell me where i made a mistake??
Encoding:
wxFFile *load_file = new wxFFile();
load_file->Open("pc.zip", "rb");
size_t size = load_file->Length();
char in[size];
unsigned long nLoadSize = load_file->Read((void *)in, size);
unsigned char out[2 +(257*nLoadSize)/254];
sqlite_encode_binary((const unsigned char*)in, 257*nLoadSize)/254, (unsigned
char*)out);
Decoding:
query_result->Execute("select * from file where ID = '1');
const char* binary = query_result->GetField(0, 2);
const char* out;
int nSize = strlen(binary);
unsigned char out[nSize];
sqlite_decode_binary((const unsigned char*)binary, (unsigned char*)out);
Result:
The zip file is broken.
Please help me,
best regardes
Martin
---------------------------------
每天都 Yahoo!奇摩
海的顏色、風的氣息、愛你的溫度,盡在信紙底圖
信紙底圖