I'm new user of wxWidget.
I want to display all the files of a folder (including those in subfolders) located on a FTP server. Then download some of them.
I have 2 problems:
1. How to display ALL the files?
If I use wxFTP::GetDirList or wxFTP::GetFilesList, I only have the files in the folder, not those in subfolders.
Can I use function which are not in wxFTP such as wxDir::GetAllFiles? In this case, in "dirname" should I only write the name of the directory or also add the hostname?
2. When I try to download a file after being connected, I 've got ERROR: "Failed to set transfer mode to binary" How to solve that?
This is my code:
Code: Select all
static void TestFtpDownload(wxTextCtrl *m_textrich)
{
wxString filename = _T("readme.txt");
wxInputStream *in = ftp.GetInputStream(filename);
if ( !in )
{
wxMessageBox(filename, _T("ERROR: couldn't get input stream for"), wxOK, NULL) ;
}
else
{
size_t size = in->GetSize();
wxMessageBox(filename ,_T("Reading file") , wxOK, NULL) ;
fflush(stdout);
wxChar *data = new wxChar[size];
if ( !in->Read(data, size) )
{
wxMessageBox(_T("RESULT"), _T("Read Error"), wxOK, NULL) ;
}
else
{
m_textrich->AppendText(data);
}
delete [] data;
delete in;
}
}
Please help me!
Thanks