Overview
Features
Download
Documentation
Community
Add-Ons & Services

Files download in FTP

General discussion regarding the development of POCO for contributors.

Files download in FTP

Postby AnithaSubramani » 22 Oct 2008, 11:57

Hi All,

Im new to Poco. I want to run the FTP download program. The sample code is
Code: Select all

#include "URIStreamOpener.h"
#include "StreamCopier.h"
#include "Path.h"
#include "URI.h"
#include "Exception.h"
#include "HTTPStreamFactory.h"
#include "FTPStreamFactory.h"
#include
#include


using Poco::URIStreamOpener;
using Poco::StreamCopier;
using Poco::Path;
using Poco::URI;
using Poco::Exception;
using Poco::Net::HTTPStreamFactory;
using Poco::Net::FTPStreamFactory;


int main(int argc, char** argv)
{
   HTTPStreamFactory::registerFactory();
   FTPStreamFactory::registerFactory();
   std::cout<   std::cout<   if (argc != 2)
   {
      Path p(argv[0]);
      std::cerr << "usage: " << p.getBaseName() << " " << std::endl;
      std::cerr << "       Download to standard output." << std::endl;
      std::cerr << "       Works with http, ftp and file URIs." << std::endl;
      return 1;
   }

   try
   {
      URI uri(argv[1]);
      std::auto_ptr pStr(URIStreamOpener::defaultOpener().open(uri));
      StreamCopier::copyStream(*pStr.get(), std::cout);
   }
   catch (Exception& exc)
   {
      std::cerr << exc.displayText() << std::endl;
      return 1;
   }
      
   return 0;
}

Im trying to run this code. The command is:
E:priyaftpdownloaddebug>ftpdownload ftp://www.imagine.com

But it is showing the below exception:
FTP Exception: Login denied: 530 Not logged in, user account has been disabled

How to give the user name and password in command line.

Please help me...................................

Thanks & Regards,

Anitha
AnithaSubramani
 
Posts: 7
Joined: 20 Oct 2008, 14:48

Re: Files download in FTP

Postby alex » 22 Oct 2008, 14:38

> How to give the user name and password in command line.

Code: Select all

ftp://user:password@host:port/path
alex
 
Posts: 1145
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Files download in FTP

Postby SeshaSridhar » 23 Oct 2008, 12:24

Hi Alex,
You had specified how to give username and password in commandline in the previous post.What does path here stand for?
ftp://user:password@host:port/path
SeshaSridhar
 
Posts: 3
Joined: 21 Oct 2008, 12:56


Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest