Public Declare Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" _ (ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
Public Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" _ (ByVal hFtpSession As Long, ByVal lpszSearchFile As String, _ lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal dwContent As Long) As LongPublic Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" _ (ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _ ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, ByVal dwFlagsAndAttributes As Long, _ ByVal dwFlags As Long, ByVal dwContext As Long) As BooleanPublic Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" _ (ByVal hFtpSession As Long, ByVal lpszLocalFile As String, _ ByVal lpszRemoteFile As String, _ ByVal dwFlags As Long, ByVal dwContext As Long) As BooleanPublic Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" _ (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean ' Initializes an application's use of the Win32 Internet functions Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _ (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, _ ByVal sProxyBypass As String, ByVal lFlags As Long) As Long Public Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" _ (ByVal hFtpSession As Long, ByVal lpszDirectory As String, ByRef lpdwCurrentDirectory As Long) As Boolean ' User agent constant.
就是这样的一类函数,但是要直接在ftp服务器中直接拷贝和粘贴操作,可能尚未发布的函数我看到C语言里面有这个函数,不知道vb+api中有没有,有了请告诉 static int FtpCopyFile(void *ctx, char *to, char *from) { static char *asfuncname = "FtpCopyFile"; ConnectInfo *ci; char buf[FTP_BUF_SIZE]; int nRead, nWrote; int status = NS_OK; int fd, rcode; FtpFile *fpFrom = NULL; FtpFile *fpTo = NULL; ci = (ConnectInfo *) ctx; if ((fpFrom = Ftpfopen(from, "r")) == NULL) { FtpLog(FtpDebug, "%s: from file NULL.", asfuncname); status = NS_ERROR; goto done; } else if ((fpTo = Ftpfopen(to, "w+")) == NULL) { FtpLog(FtpDebug, "%s: to file NULL(%s).", asfuncname, strerror(errno)); status = NS_ERROR; goto done; }
fd = Ftpfileno(fpTo); if ((status = FtpFileWLock(fpTo)) != NS_OK) { goto done; } while (1) { Ftpclearerr(fpFrom); Ftpclearerr(fpTo); nRead = Ftpfread((char *)buf, 1, (FTP_BUF_SIZE - 1), fpFrom); if (nRead == 0) { if ((rcode = Ftpferror(fpFrom))) { FtpLog(FtpDebug, "%s: Error occurred while reading from %s - [%d].", asfuncname, from, rcode); break; } if ((rcode = Ftpfeof(fpFrom))) { /* end of file...break */ break; } } FtpLog(FtpDebug, "%s: nRead bytes(%d).", asfuncname, nRead); nWrote = Ftpfwrite((char *)buf, 1, nRead, fpTo); if (nRead != nWrote) { FtpLog(FtpDebug, "%s: Error writing(%s) [read->%d != write->%d].", asfuncname, to, nRead, nWrote); status = NS_ERROR; break; } if (nWrote == 0) { if ((rcode = Ftpferror(fpFrom))) { FtpLog(FtpDebug, "%s: Error occurred while writing to %s - [%d].", asfuncname, to, rcode); } break; } FtpLog(FtpDebug, "%s: wrote bytes(%d).", asfuncname, nWrote); } done: if (fpFrom != NULL) { Ftpfclose(fpFrom); } if (fpTo != NULL) { (void)FtpFileWUnlock(fpTo); /* don't care about return code */ Ftpfclose(fpTo); } return(status); } /* FtpCopyFile */
┃
/\
/浪\
/ 漫 \
/ 情 \
/ 怀 \
/──┬──\
● │~○~
┏█┓│┏█┓
┛┗ │ ┛┗
│
└-┘
…………………………………………………………………………………… ┃
/\
/ \
/ 雨 \
/ 中 \
/ 情 \
/──┬──\
● │~○~
┏█┓│┏█┓
┛┗ │ ┛┗
http://wubin.my163.com
……………………………………………………………………………………
!!!!!
\\ - - //
(-● ●-)
\ (_) /
\ u /
┏oOOo-━━━━━━━━┓
┃ ┃
┃ 征婚启示! ┃
┃招全职女杀手№2!!!┃
┃ ┃
┗━━━━━━━━-oOOo┛
http://wubin.my163.com
…………………………………………………………………………………… ● ~○~
┏█┓┏█┓
┛┗ ┛┗
两小无猜 http://wubin.my163.com
……………………………………………………………………………………
∮∮∮∮ ∮∮∮∮
∮∮∮ ∮∮∮
∮∮ I LOVE YOU ∮∮
∮ 我爱你 ∮
http://wubin.my163.com
……………………………………………………………………………………
╱╲╱╲╰★╮【钟】╭★╯╱╲╱╲
╲封╲╱╰☆╮【爱】╭☆╯╲封╲╱
╱╲爱╲╰★╮【一】╭★╯╱╲爱╲
╲╱╲╱ ☆╮【生】╭☆╯╲╱╲╱
http://wubin.my163.com
…………………………………………………………………………………… ╭╮︵︵╭╮.╔═════════╗.
〔 ∩∩ 〕.‖╭钟╮╭意╮╭妳╮‖.
〔ミ e ミ〕.‖.╲╱..╲╱..╲╱.‖.
〔︵灬 灬︵〕╚═════════╝.
.╭╮︵☆╭╮.`╔═══╦═══╗.`.`
.〔 o o 〕╭我╮ `╭愛╮ `╭妳╮ .
.〔ミ О ミ〕.╲╱.`. ╲╱.`. ╲╱.`.
〔︵灬 灬︵〕
╔═══════W╦R═══════╗
│ ╭╮︵︵╭╮╭↓╮╭╮︵☆╭╮`│
│`〔 ∩∩ 〕 ╲╱ 〔 o o 〕.│
│.〔ミ の ミ〕` ↓ `〔ミ О ミ〕.│
│〔︵灬 灬︵〕.↓.〔︵灬 灬︵〕│
╚≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡╝
{正值ヅ帥气は善良 大方メ可愛ミ活泼}
http://wubin.my163.com
……………………………………………………………………………………☆┏┅◇ ·。 ◢◣◢◣ 。· ◇┅┓☆
ツ ┇愛┃ ·。【我爱你】 。· ┃妳┇ツ
…… →→↘◥永远◤↙←←←……
↘◥◤↙……………………………………………………………………………………
◢◣┏━━━┓ ●╭○╮┏━━━┓◢◣
◥◣┃老┇永┃/█∨█\ ┃爱┇老┃◢◤
█┃公┇远┃ ∏ ∏ ┃你┇婆┃█
◢◤┗━━━┛z我╋你z ┗━━━┛◥◣
http://wubin.my163.com……………………………………………………………………………………
╔──[.愛情沒有公平.]──╗開
│ [.誰愛错誰傷訫.] │始
│ [.我已决定放棄.] │懂
╚──[.不管是否受傷.]──╝了 ……………………………………………………………………………………
(((\\~¨~'|╭永╮ ╔◇╗ ╭远╮o深o
)a ,¨¨ | ╲╱ ╔┘相└╗ ╲╱ o爱o
0\_ /¨~|╚┐爱┌╝o着o
оo\ \~~ |美眉┏┛╚◇╝┗┓帅哥o你o...
……………………………………………………………………………………((((\\校╰ ☆倔强ミ╃嚣张ヅ『我个性』
)a ,花╰☆上网ミ╃恋爱ヅ『我生活』
0\_ / ╰ ☆哭泣ミ╃撒娇ヅ『我态度』
оo\ \~╰ ☆老公ミ╃刘桥ヅ『我所有』
http://wubin.my163.com
,如果有能贴一下吗?
(ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
Public Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" _
(ByVal hFtpSession As Long, ByVal lpszSearchFile As String, _
lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal dwContent As Long) As LongPublic Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" _
(ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _
ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, ByVal dwFlagsAndAttributes As Long, _
ByVal dwFlags As Long, ByVal dwContext As Long) As BooleanPublic Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" _
(ByVal hFtpSession As Long, ByVal lpszLocalFile As String, _
ByVal lpszRemoteFile As String, _
ByVal dwFlags As Long, ByVal dwContext As Long) As BooleanPublic Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" _
(ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
' Initializes an application's use of the Win32 Internet functions
Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _
(ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, _
ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Public Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" _
(ByVal hFtpSession As Long, ByVal lpszDirectory As String, ByRef lpdwCurrentDirectory As Long) As Boolean
' User agent constant.
static int FtpCopyFile(void *ctx, char *to, char *from) { static char *asfuncname = "FtpCopyFile";
ConnectInfo *ci;
char buf[FTP_BUF_SIZE];
int nRead, nWrote;
int status = NS_OK;
int fd, rcode;
FtpFile *fpFrom = NULL;
FtpFile *fpTo = NULL; ci = (ConnectInfo *) ctx; if ((fpFrom = Ftpfopen(from, "r")) == NULL) {
FtpLog(FtpDebug, "%s: from file NULL.", asfuncname);
status = NS_ERROR;
goto done;
} else if ((fpTo = Ftpfopen(to, "w+")) == NULL) {
FtpLog(FtpDebug, "%s: to file NULL(%s).", asfuncname,
strerror(errno));
status = NS_ERROR;
goto done;
}
fd = Ftpfileno(fpTo); if ((status = FtpFileWLock(fpTo)) != NS_OK) {
goto done;
} while (1) { Ftpclearerr(fpFrom);
Ftpclearerr(fpTo); nRead = Ftpfread((char *)buf, 1, (FTP_BUF_SIZE - 1), fpFrom); if (nRead == 0) {
if ((rcode = Ftpferror(fpFrom))) {
FtpLog(FtpDebug,
"%s: Error occurred while reading from %s - [%d].",
asfuncname, from, rcode);
break;
}
if ((rcode = Ftpfeof(fpFrom))) {
/* end of file...break */
break;
}
} FtpLog(FtpDebug, "%s: nRead bytes(%d).", asfuncname, nRead); nWrote = Ftpfwrite((char *)buf, 1, nRead, fpTo); if (nRead != nWrote) {
FtpLog(FtpDebug, "%s: Error writing(%s) [read->%d != write->%d].",
asfuncname, to, nRead, nWrote);
status = NS_ERROR;
break;
} if (nWrote == 0) {
if ((rcode = Ftpferror(fpFrom))) {
FtpLog(FtpDebug, "%s: Error occurred while writing to %s - [%d].",
asfuncname, to, rcode);
}
break;
}
FtpLog(FtpDebug,
"%s: wrote bytes(%d).", asfuncname, nWrote);
} done: if (fpFrom != NULL) {
Ftpfclose(fpFrom);
}
if (fpTo != NULL) {
(void)FtpFileWUnlock(fpTo); /* don't care about return code */
Ftpfclose(fpTo);
}
return(status);
} /* FtpCopyFile */