Click here to Skip to main content
15,901,505 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I want to use ActiveExperts FtpFile component but have problem. They offer manual but sample code is written only in VBscript :

VB
Set objFtpServer = CreateObject ( "ActiveXperts.FtpServer" )

objFtpServer.Connect "ftp.activexperts-labs.com","anonymous","" ' Connect to the FTP server                                                                ' using the anonymous account 
Wscript.Echo "Connect, result: " & objFtpServer.LastError
If( objFtpServer.LastError <> 0 ) Then                          ' If connect failed then quit
   WScript.Quit
End If

objFtpServer.ChangeDir "samples/ASocket/Visual Basic/Telnet"    ' Change directory
Wscript.Echo "ChangeDir, result: " & _
 objFtpServer.LastError
If( objFtpServer.LastError <> 0 ) Then                          ' If ChangeDir fails then 
                                                                ' disconnect and quit
   objFtpServer.Disconnect
   WScript.Quit
End If

Set objFtpFile = objFtpServer.FindFirstFile()                   ' Iterate over all files in dir 
                                                                ' Start with first file
While( objFtpServer.LastError = 0 )
   WScript.Echo "Name: " & objFtpFile.Name                      ' Display file name
   WScript.Echo "IsDirectory: " & objFtpFile.IsDirectory        ' Display directory or file
   WScript.Echo "Size: " & objFtpFile.Size                      ' Display file size
   WScript.Echo "Date: " & objFtpFile.Date                      ' Display file date
    
   ' To save the file, call the GetFile function. 
   ' strSaveAs = "C:\temp\" & objFtpFile.Name
   ' objFtpServer.GetFile objFtpFile.Name, strSaveAs
   ' Wscript.Echo "Save file, result: " & objFtpServer.LastError

   ' To delete a file, call the DeleteFile function. 
   ' objFtpServer.DeleteFile objFtpFile.Name
   ' Wscript.Echo "Delete, result: " & objFtpServer.LastError

   Set objFtpFile = objFtpServer.FindNextFile()                 ' Next file
Wend

objFtpServer.Disconnect  


I wrote code in C++ Builder 6:

C++
TCOMIFtpServer m_objFtpServer;     
 TCOMIFtpFile m_objFtpFile;

  m_objFtpServer =  CoFtpServer::Create();
  m_objFtpFile = CoFtpFile::Create();

  m_objFtpServer->Clear();

  m_objFtpServer->set_LogFile(WideString (ftplog_filename));
  m_objFtpServer->set_HostPort(21);
  m_objFtpServer->set_BinaryTransfer(0);
  m_objFtpServer->set_PassiveMode(0);

  m_objFtpServer->Connect(WideString ("xxx"), WideString ("Admin"), WideString ("yyy"));

   if( m_objFtpServer->LastError == 0 )
    {
       m_objFtpFile = m_objFtpServer->FindFirstFile(); 


and have an error in a last line:
[C++ Error] rj1.cpp(26141): E2285 Could not find a match for 'TCOMIFtpFile::operator =(tagVARIANT)'

Anybody have idea where is a problem?
Thank you.
Posted
Updated 29-Sep-11 22:06pm
v2
Comments
Madhu Nair 30-Sep-11 4:26am    
Are you getting error in
"if( m_objFtpServer->LastError == 0 )"
what is the type of LastError ?
Or
"m_objFtpFile = CoFtpFile::Create();" what is the return type of
CoFtpFile::Create(); is it a pointer ?
SilnyLeszek 30-Sep-11 4:55am    
LastError is long, connection to server is OK and it's return 0,
CoFtpFile::Create(); returns a pointer ;
SilnyLeszek 30-Sep-11 8:21am    
FindFirstFile() returns an FtpFile object. This is ActiveX VARIANT type object. I didn't see any method to assign this object to a new declared FtpFile object.

1 solution

There is either:
1. a missing override of operator= in the TCOMIFtpFile implementation. OR
2. You have included an assignment operation (target = expression) that does not match any of the existing overrides.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900