Evaus
asked on
How do I create a file using ATL ASP COM?
I'm Trying to Create a Method that creates a file in an ATL ASP COM using C++.
Here is my code, but no file is created:
STDMETHODIMP CDV::Create_File(BSTR FileName)
{
ts_out_handle = CreateFile((LPCTSTR)FileNa me,
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (ts_out_handle == INVALID_HANDLE_VALUE)
{
return S_FALSE;
}
return S_OK;
}
Thanks
Evaus
Here is my code, but no file is created:
STDMETHODIMP CDV::Create_File(BSTR FileName)
{
ts_out_handle = CreateFile((LPCTSTR)FileNa
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (ts_out_handle == INVALID_HANDLE_VALUE)
{
return S_FALSE;
}
return S_OK;
}
Thanks
Evaus
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ts_out_handle = CreateFileW((LPCTSTR)FileN
Note the capital 'W', it refers to the UNICODE version of 'CreateFile()'