asked on
/*
Working Way! but slow as hell ..
*/
int bits_add_files(LPWSTR str_local, LPWSTR str_remote, int i_Index) {
gbJob->AddFile(str_remote,str_local);
return i_Index;
};
int cool_function(...) {
wstring local, remote;
while (..) {
lpstr_local = (LPWSTR) malloc ( sizeof(LPWSTR) *local.length());
lpstr_local = (wchar_t*)local.c_str();
lpstr_remote = (LPWSTR) malloc ( sizeof(LPWSTR) *remote.length());
lpstr_remote = (wchar_t*)remote.c_str();
bits_add_files(lpstr_local,lpstr_remote,index);
};
};
/*
WANTED WAY .. i wan't to get rid of calling "bits_add_files()"
*/
int cool_functions(...) {
wstring local, remote;
while (..) {
lpstr_local = (LPWSTR) malloc ( sizeof(LPWSTR) *local.length());
lpstr_local = (wchar_t*)local.c_str();
lpstr_remote = (LPWSTR) malloc ( sizeof(LPWSTR) *remote.length());
lpstr_remote = (wchar_t*)remote.c_str();
gbJob->AddFile(lpstr_remote,lpstr_local);
/*
This does compile well BUT after "cool_function" finished, the Files Array of BITS ( gbjob ) is EMPTY!
I'm guessing that i have to somehow copy the memory over to the AddFile Call.
AddFile Returns "E_INVALIDARG".
*/
};
};