Take the 2-minute tour ×

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.

share|improve this question
It is shared folder, just copy the file. –  Hans Passant Mar 18 '10 at 7:44
@nobugz, I don't think your comment is specific to question. –  Siddiqui Mar 19 '10 at 7:31
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer


