PutData to create empty file - WeOnlyDo Discussion board

PutData to create empty file (General questions)

by Oleg, Thursday, August 16, 2007, 17:06 (6309 days ago)

Hi,
I am trying to use PutData to create empty file on FTP server.
Code is like this (VC++):

VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = SysAllocString(_T( /test.txt ));
SFtp->PutData(_T( ), var);

But COleDispatchException occured.
What I am doing wrong?

Re: PutData to create empty file

by wodSupport, Thursday, August 16, 2007, 21:37 (6308 days ago) @ Oleg

Oleg,

that exception should contain some message or error number. Can you tell me what it is?

Kreso

Re: PutData to create empty file

by Oleg, Friday, August 17, 2007, 00:20 (6308 days ago) @ wodSupport

I get message:

Unhandled exception at 0x7675b09e in Appname.exe: Microsoft C++ exception: COleDispatchException at memory location 0x02d0dc28..

Re: PutData to create empty file

by wodSupport, Friday, August 17, 2007, 00:26 (6308 days ago) @ Oleg

Oleg,

are you sure that

SFtp->PutData(_T( ), var);

first argument is also BSTR? This looks to me like invalid argument issue, which in C++ gives you results like you experienced it..

Kreso

Re: PutData to create empty file

by Oleg, Friday, August 17, 2007, 00:48 (6308 days ago) @ wodSupport

Solved it.
Error was that I put SetBlocking(TRUE) before CreateDispatch.
After fixing exception disappeared.
And replace
var.bstrVal = SysAllocString(_T( /test.txt ))
with
var.bstrVal = _T( /test.txt )
It work
Thank you