Click here to Skip to main content
15,892,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
Questionplease help me. Pin
liuyajuan21-Apr-08 16:18
liuyajuan21-Apr-08 16:18 
GeneralRe: please help me. Pin
Le@rner21-Apr-08 18:00
Le@rner21-Apr-08 18:00 
GeneralFailed to initialize object in a constructor Pin
cydd7-Mar-08 23:55
cydd7-Mar-08 23:55 
AnswerRe: Failed to initialize object in a constructor [modified] Pin
Rajkumar R8-Mar-08 0:00
Rajkumar R8-Mar-08 0:00 
GeneralRe: Failed to initialize object in a constructor Pin
cydd8-Mar-08 22:37
cydd8-Mar-08 22:37 
Generalgraph plotting.. Pin
Member 47738777-Mar-08 23:00
Member 47738777-Mar-08 23:00 
GeneralRe: graph plotting.. Pin
CPallini7-Mar-08 23:35
mveCPallini7-Mar-08 23:35 
GeneralRe: graph plotting.. Pin
Member 47738778-Mar-08 0:51
Member 47738778-Mar-08 0:51 
Generalinstantiation point discussion Pin
George_George7-Mar-08 22:24
George_George7-Mar-08 22:24 
GeneralRe: instantiation point discussion Pin
Rajkumar R7-Mar-08 22:43
Rajkumar R7-Mar-08 22:43 

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.