问问使用cftpfilefind::getfilename从solaris系统取得文件名的问题,以前有大虾问过,无人解哦

hexuyi 2005-01-10 11:44:29
小弟使用微软类cftpfilefind中的getfilename方法,要从solaris系统登录目录下取得文件名,却发现文件名前面均有一些时间信息的字符并带空格,(如7 19:40 test.txt等),取得目录名时也是这样;
如果用telnet登录进去却只看到test.txt,看不到前面其他的字符,请问这与cftpfilefind类有关么,有没有其他的方法取得不带前面字符的文件名?谢谢!

...全文
102 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
mansm 2010-06-11
  • 打赏
  • 举报
回复
无法解决该问题,我问过微软工程师了.
hexuyi 2005-01-29
  • 打赏
  • 举报
回复
再顶一下,望高手指点,谢谢
xuzheng318 2005-01-10
  • 打赏
  • 举报
回复
#include <afx.h>
#include <afxwin.h>
#include <afxinet.h>
#include <stdio.h>

// compile for release with
// cl /MT /GX
// or for debug with
// cl /MTd /GX

CWinApp theApp;

void main()
{
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// catastropic error! MFC can't initialize
return;
}

// create a session object to initialize WININET library
// Default parameters mean the access method in the registry
// (that is, set by the "Internet" icon in the Control Panel)
// will be used.

CInternetSession sess(_T("MyProgram/1.0"));

CFtpConnection* pConnect = NULL;

try
{
// Request a connection to ftp.microsoft.com. Default
// parameters mean that we'll try with username = ANONYMOUS
// and password set to the machine name @ domain name
pConnect = sess.GetFtpConnection(_T("ftp.microsoft.com"));

// use a file find object to enumerate files
CFtpFileFind finder(pConnect);

// start looping
BOOL bWorking = finder.FindFile(_T("*"));

while (bWorking)
{
bWorking = finder.FindNextFile();
printf("%s\n", (LPCTSTR) finder.GetFileURL());
}
}
catch (CInternetException* pEx)
{
TCHAR sz[1024];
pEx->GetErrorMessage(sz, 1024);
printf("ERROR! %s\n", sz);
pEx->Delete();
}

// if the connection is open, close it
if (pConnect != NULL)
pConnect->Close();
delete pConnect;

return;
}

hexuyi 2005-01-10
  • 打赏
  • 举报
回复
先谢谢马甲1号,呵呵,
代码我试了了一下,其中
printf("%s\n", (LPCTSTR) finder.GetFileURL());
得到的是文件在ftp上的绝对路径,如:ftp://xxx.xxx.xxx.xxx/root/1 10:02 test.txt
其名字仍带有时间信息及空格等;

而且我发现,如用cuteftp等客户端工具登录上去就看不到多的那些奇怪字符,用ie直接登录就能看到,这是为什么?是微软类ctfpfilefind的bug?请大家赐教。

64,648

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧