FtpCommand的用法

hqylfy 2004-01-15 10:41:13
哪位能详细的解释一下FtpCommand的用法?
...全文
146 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hqylfy 2004-01-18
  • 打赏
  • 举报
回复
谢谢!
warton 2004-01-18
  • 打赏
  • 举报
回复
调用GetLastError()看看是什么错误?
最后一个参数好像设置不对

FtpCommand
Sends commands directly to an FTP server.

BOOL FtpCommand(
HINTERNET hConnect,
BOOL fExpectResponse,
DWORD dwFlags,
LPCTSTR lpszCommand,
DWORD_PTR dwContext,
HINTERNET* phFtpCommand
);

Parameters
hConnect
[in] Handle returned from a call to InternetConnect.
fExpectResponse
[in] Indicates whether or not the application expects a response from the FTP server. This must be set to TRUE if a response is expected, or FALSE otherwise.
dwFlags
[in] Controls this function. This parameter can be set to one of the following values.Value Meaning
FTP_TRANSFER_TYPE_ASCII Transfers the file using FTP's ASCII (Type A) transfer method. Control and formatting information is converted to local equivalents.
FTP_TRANSFER_TYPE_BINARY Transfers the file using FTP's Image (Type I) transfer method. The file is transferred exactly as it exists with no changes. This is the default transfer method.

lpszCommand
[in] Pointer to a string that contains the command to send to the FTP server.
dwContext
[in] Pointer to a variable that contains an application-defined value that is used to identify the application context in callbacks.
phFtpCommand
[out] Pointer to a handle that will be created if a valid data socket is opened. The fExpectResponse parameter must be set to TRUE for phFtpCommand to be filled.
warton 2004-01-17
  • 打赏
  • 举报
回复
执行ftp协议规定的相关命令吧

void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString AnID, APass;
if (InputQuery("Authentication needed", "Enter User ID", AnID))
if (InputQuery("Authentication needed", "Enter Password", APass))
{
NMFTP1->DoCommand("USER "+AnID);
NMFTP1->DoCommand("PASS "+APass);
}
}
hqylfy 2004-01-17
  • 打赏
  • 举报
回复
我希望调用WinInet的FtpCommand函数,老是返回false
代码如下:

char Comm[50]="TYPE A \r\n";
bool CommOK=FtpCommand(Inet,250,
FTP_TRANSFER_TYPE_ASCII,
&Comm[0],
255,NULL);

我想知道FtpCommand中各个参数的含义

1,317

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 网络及通讯开发
社区管理员
  • 网络及通讯开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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