gpt4 book ai didi

c++ - PutFile 不从事件目录发送文件?

转载 作者:行者123 更新时间:2023-11-28 03:45:36 25 4
gpt4 key购买 nike

pConnect->SetCurrentDirectory( "C:\\FilesToSendToServer" ); //Need this set on client, i believe currently setting on server.
CFtpFileFind finder(pConnect);
finder.FindFile( "*", INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_EXISTING_CONNECT );
finder.FindNextFile();
CString filename = finder.GetFileName(); //finds the only file in that directory - test.txt

pConnect->PutFile( filename, "C:\\FilesReceived\\FILE_SENT_FROM_CLIENT.txt", FTP_TRANSFER_TYPE_BINARY, 1 )) //filename set to test.txt correctly

在客户端我有一个目录 FilesToSendToServer 和一个测试文件 - “test.txt”

我在客户端也有这个应用程序的工作目录 - C\uploadApp\

上面的代码正确设置了当前目录并“找到”了测试文件。

但是,当 PutFile 以正确设置的文件名参数 (test.txt) 执行时,函数返回错误文件未找到。

作为测试,我将 test.txt 的拷贝放在应用程序工作目录 uploadApp 中,它确实将文件发送到服务器。

如果在 CFtpConnection 对象中设置了事件目录,为什么文件需要在工作目录中才能发送?

(这是否意味着对于我想从客户端发送的任何文件,我都必须将其复制到应用程序的目录中?)

谢谢。

编辑
看起来像 SetCurrentDirectory 调用 FtpSetCurrentDirectory

determine the remote site's current working directory

所以对于 GET 这将是有意义的...是否有 PUT 的替代功能 - 设置本地机器的事件目录? (仅供引用 - 无法区分在同一台机器上测试的服务器上的远程目录......如果在目标上测试 SetCurrentDirectory 应该失败,因为它正在服务器上寻找......我假设)

最佳答案

看起来您打算调用 win32 API SetCurrentDirectory .这将更改本地 目录,而不是pConnect->SetCurrentDirectory 更改的远程 目录。如果您在命名空间中,请尝试::SetCurrentDirectory。当然,您的工作目录将不再是 C:\uploadApp...

关于c++ - PutFile 不从事件目录发送文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7797927/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com