Link to home
Start Free TrialLog in
Avatar of Evaus
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)FileName,
          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
Avatar of _ov
_ov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jkr
If UNICODE in general is OK for you, just use



    ts_out_handle = CreateFileW((LPCTSTR)FileName

Note the capital 'W', it refers to the UNICODE version of 'CreateFile()'