Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP file in C code

Status
Not open for further replies.

stevensteven

Programmer
Jan 5, 2004
108
CA
How would I ftp a file from my c code using a

char *cmd;
int status = 0;

strcpy(cmd, "ftp ???????");
status = System(cmd);


Or is there any other way I could do this??


Thanks for any help,

Steven

 
Something like
Code:
char cmd[200];
char *site = "ftp.com";  // or your user input...
sprintf( cmd, "ftp %s", site );
system( cmd );

Whether you actually get the status of the ftp command itself back from calling system() is implementation-specific. It would work OK on Unix/Linux, but DOS/Win32 certainly doesn't work with some compilers.

--
 
libcurl handles this stuff quite nicely -

There is a bit of a learning curve understanding the library,
but once you get past that, doing ftp, http, https, uploads,
downloads, cookies, authentication, etc, etc, etc...
- is relatively easy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top