简体   繁体   中英

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 directions - 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM