Hi all,
I'm using a BSTR as an out parameter in a function which reads a file. Here is my code.
HRESULT __stdcall CA::getFile(BST R bstr,BSTR *fileCont)
{
if (!fileCont)
return E_POINTER;
wstring str;
char sz_path[255];
wifstream inFile;
size_t bufsize;
wchar_t* path=bstr;
std::wstring _temp;
bufsize = wcstombs(sz_pat h,path,255);
if(bufsize==siz eof(sz_path) || bufsize==-1)
{
return S_FALSE;
}
inFile.open(sz_ path);
if(!inFile.is_o pen())
return S_FALSE;
while(!inFile.e of())
{
inFile >> str;
}
*fileCont = SysAllocString( OLESTR(str));
return S_OK;
}
I'm getting errors in the statement SysAllocString( OLESTR(str)).
Please correct my syntax.
Thanks a lot.
SC
I'm using a BSTR as an out parameter in a function which reads a file. Here is my code.
HRESULT __stdcall CA::getFile(BST R bstr,BSTR *fileCont)
{
if (!fileCont)
return E_POINTER;
wstring str;
char sz_path[255];
wifstream inFile;
size_t bufsize;
wchar_t* path=bstr;
std::wstring _temp;
bufsize = wcstombs(sz_pat h,path,255);
if(bufsize==siz eof(sz_path) || bufsize==-1)
{
return S_FALSE;
}
inFile.open(sz_ path);
if(!inFile.is_o pen())
return S_FALSE;
while(!inFile.e of())
{
inFile >> str;
}
*fileCont = SysAllocString( OLESTR(str));
return S_OK;
}
I'm getting errors in the statement SysAllocString( OLESTR(str)).
Please correct my syntax.
Thanks a lot.
SC