TCHAR行尾字符

时间:2010-03-23 07:01:51

标签: string visual-c++

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);

在最后一行获得一个没有行结束字符的字符串后,如何解决这个问题? 附:如何这样做将是“ftp://ftp.microsoft.com/bussys/”,如果两个字符串都是TCHAR,请获取字符串ftp.microsoft.com?

1 个答案:

答案 0 :(得分:1)

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