开发者

FTP file transfer on Windows platform using ANSI C?

I have a known shared folder on another Windows PC and i have to transfer files using my ANSI C program to that shared folder using an FTP connection. I need some direction开发者_StackOverflows - please guide me.


ANSI C standard does not include any networking library. If you can use 3rd party libraries, then you need something libcurl or some other C networking library or to create an FTP client from ground up using Winsock.


you should be careful not to confuse a shared folder and an FTP server: on Windows, the 2 have different meanings (a shared folder uses the SMB protocol, aka Samba).

For FTP transfert, you should use WinINet (which is part of the Windows SDK). This library defines a set of functions for retrieving data from the internet as well as uploading data, and support the FTP and HTTP protocols.

specifically, you need to call InternetOpenUrl() or InternetConnect() to open the connection, FtpSetCurrentDirectory() to navigate to the destination directory, then FtpPutFile() to upload the file. finally, use InternetCloseHandle() to close the connection.

have a look at the WinINet documentation about FTP sessions on the MSDN.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜