c code to login to ftp server while reading all login info from a file
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
c code to login to ftp server while reading all login info from a file
i am urgently in need of a c code for my B.Tech. last sem project, while will read ftp server login info like IP,user name,password from a file and log in to ftp server...
gotta urgent
do you have a test code or something to start with?
_____________________________________
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
Happy with solution ... mark as SOLVED
(located in the "thread tools")
i just wrote a program to just read a file as the file will store all the necessary inputs for login like IP,User,Pass.
and stored in structure but dont know to which should i pass these arguments for login.i already have created an FTP server by installing "VSFTPD package"..can u assist on this.
yes, you need to open file and parse data. here is a little example on how to open and read a file using fopen and fscanf. Can you fill up the ip, user and pass variables?
There are some problems with your code, but first: please use [code][/code] to keep formatting your code.
1. probably 16 bytes are not enough to store ip/user/pass. In case of overflow your app may die with a segmentation fault or similar, or will destroy some data inside.
2. you did not check the result of fscanf.
3. here is a simple ftp client: http://enggedu.com/lab_exercise/netw...FTP_client.php. With this you can connect to a server.
4. you can try to log in, send commands and receive response.
_____________________________________
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
Happy with solution ... mark as SOLVED
(located in the "thread tools")
pan64:Actually i m in need of some FTP API functions which will logon with my attributes,send files(PUT),recieve files{GET},and then exits.thats my idea of project..
now can u assist me on that as at this level m not vrt good at Googling..
--
Respond
_____________________________________
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
Happy with solution ... mark as SOLVED
(located in the "thread tools")
but if i call like this,giving only one argument,it gives error like
Code:
/*
if(!FtpConnect(value->ip))
{
printf("Error in connection");
}
Error:
parse.c: In function ‘main’:
parse.c:52: error: too few arguments to function ‘FtpConnect’
*/
so wat structure ref should i pass there..
will u please write that function with its passing arguments.with that argument declaration.
coz for last 2hrs i am searching for "Arguments for FtpConnect" in google and result is ZERO
--
that is written, you do not understand: you must give a second argument, which is a pointer:
Code:
netbuf *nControl;
if(!FtpConnect(value->ip, &nControl))
{
printf("Error in connection");
}
// this nControl will identify your connection and will be used as a handle in the subsequent calls you will make...
just perfectly fine and running successfully..
jst got stuck in sending & receiving files..Actually program halts at some point after entering to the function FtpGet(...)
Putting Rough structure in here,have a look on FtpGet() function plz
giving you details..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.