Click here to Skip to main content
15,915,019 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to extract a single character from a CString Pin
CPallini8-Mar-08 10:01
mveCPallini8-Mar-08 10:01 
GeneralRe: How to extract a single character from a CString Pin
Mark Salsbery8-Mar-08 10:24
Mark Salsbery8-Mar-08 10:24 
GeneralRe: How to extract a single character from a CString Pin
CPallini8-Mar-08 10:54
mveCPallini8-Mar-08 10:54 
GeneralRe: How to extract a single character from a CString Pin
Mark Salsbery8-Mar-08 10:57
Mark Salsbery8-Mar-08 10:57 
GeneralRe: How to extract a single character from a CString Pin
Larry Mills Sr8-Mar-08 14:19
Larry Mills Sr8-Mar-08 14:19 
GeneralRe: How to extract a single character from a CString Pin
Mark Salsbery8-Mar-08 15:07
Mark Salsbery8-Mar-08 15:07 
GeneralRe: How to extract a single character from a CString Pin
Larry Mills Sr9-Mar-08 5:54
Larry Mills Sr9-Mar-08 5:54 
GeneralRe: How to extract a single character from a CString Pin
Mark Salsbery9-Mar-08 8:09
Mark Salsbery9-Mar-08 8:09 
GeneralRe: How to extract a single character from a CString Pin
Larry Mills Sr10-Mar-08 4:35
Larry Mills Sr10-Mar-08 4:35 
GeneralRe: How to extract a single character from a CString Pin
Mark Salsbery10-Mar-08 6:37
Mark Salsbery10-Mar-08 6:37 
GeneralRe: How to extract a single character from a CString Pin
Larry Mills Sr11-Mar-08 9:09
Larry Mills Sr11-Mar-08 9:09 
GeneralRe: How to extract a single character from a CString Pin
Larry Mills Sr8-Mar-08 14:07
Larry Mills Sr8-Mar-08 14:07 
GeneralRe: How to extract a single character from a CString Pin
Mark Salsbery8-Mar-08 14:30
Mark Salsbery8-Mar-08 14:30 
GeneralRe: How to extract a single character from a CString Pin
Larry Mills Sr8-Mar-08 14:45
Larry Mills Sr8-Mar-08 14:45 
GeneralRe: How to extract a single character from a CString Pin
Mark Salsbery8-Mar-08 15:05
Mark Salsbery8-Mar-08 15:05 
QuestionRe: How to extract a single character from a CString Pin
CPallini8-Mar-08 22:51
mveCPallini8-Mar-08 22:51 
GeneralHelp in De Morgans Law Pin
Ryano8-Mar-08 5:45
Ryano8-Mar-08 5:45 
GeneralProblem for Download directory FTP VC++ code Pin
chetanjoshi98-Mar-08 4:40
chetanjoshi98-Mar-08 4:40 
Please look at my code given below.

I am trying to download the one folder from one site using FTP
I have written the code for Download directory which calls itself recursivly and I am closing and opening the connetion eac time.

But the problem is it downloads only first two folders completly but it could not find the third folder or file though it is there.

FindNextFile function returns false after downloading second folder.

Please help me for this..
Here is the code for Download Directory

BOOL CFTPUpDwnldManager::DownloadDirectory(CString strSrcDirPth,
CString strTrgfDirPath)
{
BOOL bRetVal = FALSE;

theApp.WriteFTPlog("Src Directory:" + strSrcDirPth);
theApp.WriteFTPlog("Trg Directory:" + strTrgfDirPath);

if(strSrcDirPth.IsEmpty() || strTrgfDirPath.IsEmpty())
{
return bRetVal;
}

// assum that *.* is not apped in src and trg path
CString strSrcDirPth1 = strSrcDirPth;

int index = strSrcDirPth1.ReverseFind('//');
int indx= strSrcDirPth1.GetLength() - index;
CString strSrcDirPth2 = strSrcDirPth1.Right(indx);
CString RemoteDir=strSrcDirPth;

CString dirpath=strTrgfDirPath + strSrcDirPth2;

CreateDirectory(dirpath,NULL);
CString LocalDir = dirpath;


CFTPUpDwnldManager *pCFTPUpDMngr = (CFTPUpDwnldManager *)lParam;
if(NULL == pCFTPUpDMngr)
{
return bRetVal;
}

CFTPManager *pFTPManager = (CFTPManager *)lParam;
if(NULL == pFTPManager)
{
return bRetVal;
}

CNSInternetSession* pInternetSession = pFTPManager->GetInternetSessionPtr();
if(NULL == pInternetSession)
{
return bRetVal;
}


pCFTPUpDMngr->CloseFTPConnection();

if(-1 == pCFTPUpDMngr->GetFTPConnection())
{
return bRetVal;
}

CFtpFileFind fileFind(pFtpConnection,0);

CString strFindFilePath = RemoteDir + "/*.*";

BOOL bContinue = fileFind.FindFile(strFindFilePath) ;

DWORD dw = GetLastError();

if (!bContinue)
{
// the directory is empty; just close up and return.
fileFind.Close();
return bRetVal;
}

while (bContinue)
{

bContinue = fileFind.FindNextFile();

DWORD dw = GetLastError();

CString tempDirName = fileFind.GetFileName();
CString tempDirPath = fileFind.GetFilePath();

CString tempFileUrl= fileFind.GetFileURL();
if(fileFind.IsDots())
{
continue;
}

if (fileFind.IsDirectory())
{

CString NewSrcDir = RemoteDir + "/" + tempDirName;
//CString NewTrgDIr = LocalDir + "/" + tempDirName;
CString NewTrgDir = LocalDir;


DownloadDirectory( NewSrcDir ,NewTrgDir );
}
else
{
DownloadFile( RemoteDir + "/" + tempDirName ,LocalDir + "/" + tempDirName );

}
}


bRetVal = TRUE;
return bRetVal;
}
GeneralRe: Problem for Download directory FTP VC++ code Pin
ptr_Electron10-Mar-08 23:35
ptr_Electron10-Mar-08 23:35 
Generalplease help me. Pin
Le@rner8-Mar-08 1:19
Le@rner8-Mar-08 1:19 
GeneralRe: please help me. Pin
Cranky8-Mar-08 1:31
Cranky8-Mar-08 1:31 
GeneralRe: please help me. Pin
Mark Salsbery8-Mar-08 10:27
Mark Salsbery8-Mar-08 10:27 
GeneralRe: please help me. Pin
Hamid_RT9-Mar-08 0:49
Hamid_RT9-Mar-08 0:49 
GeneralRe: please help me. Pin
Mark Salsbery9-Mar-08 8:11
Mark Salsbery9-Mar-08 8:11 
GeneralRe: please help me. Pin
Hamid_RT9-Mar-08 19:50
Hamid_RT9-Mar-08 19:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.