views:

29

answers:

1
int DownloadFtpDirectory(TCHAR* DirPath) { 
WIN32_FIND_DATA FileData;  
UINT a; 
TCHAR* APP_NAME = TEXT("ftpcli"); 
TCHAR* f;
int j = 5;
do {
  j++;
  f = _tcsninc(DirPath, j);
}while (_tcsncmp(f, TEXT("/"), 1));
TCHAR* PATH_FTP = wcsncpy(new TCHAR[j], DirPath, j);

After the last line gets a string in which there is no line ending character, how to fix this? P.S. how to do so would be out of line "ftp://ftp.microsoft.com/bussys/", get a string ftp.microsoft.com if both strings are TCHAR ?

+1  A: 
TCHAR* PATH_FTP = wcsncpy(new TCHAR[j+1], DirPath, j);
PATH_FTP[j] = TEXT('\0');
Windows programmer