Thread: Ftp Help

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    14

    Ftp Help

    Hi, im a totaly noob on C++
    So im "trying" to make a scripts that upload a file from my hard disk to a ftp server.
    What the scripts has to do is:
    connect to ftp server
    transfer
    and close

    You probaly find this basic, but can you help me with this. All is it giving me a site with ftp functions ...

  2. #2
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    I wouldn't suggest doing this if you are a noob...since it does require more than just typing in "connect here and send there". Learn more C/++, and learn WinSOCK [if you are despereate, than I'd say do this in VB].

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    So why not use the "ftp" program which comes with your system and save yourself a whole bunch of work?

    Or is that the whole point of the exercise.
    If it is, check out the networking board on this site for lots of links which help you create a basic connection to a remote internet site. Once you've mastered that, then all you need to do is figure out how to talk "FTP" to the remote site and you'll be on your way to solving the problem.

  4. #4
    Registered User
    Join Date
    Dec 2004
    Posts
    14
    Its just a script for fun, and learning. i will see at the site networking board. but i dont understand english that good so its hard to learn from an english tutorial site ...

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    The harsh reality is that english is the language of the internet. You would do well to learn it if you want to use the web as a resource.
    My best code is written with the delete key.

  6. #6
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    You can probably learn what you need to know just by looking at source code, and reading the documentation on the functions you need. The functions you will need to call are:

    WSAStartup() (Only if you are using windows)
    gethostbyname() (To convert a domain to an ip address)
    connect()
    send()
    recv()
    close() (linux only)
    closesocket() (windows only)

    Once you connect, the FTP commands you would need to use are:
    USER
    PASS
    STOR
    QUIT

  7. #7

  8. #8
    Registered User
    Join Date
    Dec 2004
    Posts
    5
    I'm a newbie to C++ as well and I realized the more you learn about something different is the more you learn about making your own stuff. I'm not even done the turtorials on this site and yet I have learned a lot from other people's project files. If you take them and read them, it'll help alot and in most cases its the best place to look for help.
    I havent still got the hang of DevC++ it keeps telling me
    `endl'
    undeclared (first use this function)
    or for 'cout' as well but I'm trying ^_^.

    Well Good Luck with your ftp project. There are a lot of beneficial people in here you can ask them for help .

  9. #9
    Registered User
    Join Date
    May 2004
    Posts
    12
    Well DiGiT I can guarantee you your problem is one of the following:
    1. Be sure to #include <iostream>
    2. The functions you're trying to use are in the std namespace, so either use std::cout and std::endl or put
    Code:
    using namespace std;
    after your #includes.

  10. #10
    Registered User
    Join Date
    Dec 2004
    Posts
    14

    Re:

    When im tring any of your function and compile i get this error:

    `connect' undeclared (first use this function)
    Do i need to include something special ?

    Quote Originally Posted by bithub
    You can probably learn what you need to know just by looking at source code, and reading the documentation on the functions you need. The functions you will need to call are:

    WSAStartup() (Only if you are using windows)
    gethostbyname() (To convert a domain to an ip address)
    connect()
    send()
    recv()
    close() (linux only)
    closesocket() (windows only)

    Once you connect, the FTP commands you would need to use are:
    USER
    PASS
    STOR
    QUIT

  11. #11
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    You need to tell us what operating system you are using. It's different for each one. and DO NOT start using these functions without reading a tutorial on the Networking API for your OS. WinSock if you are using Windows. Do a google search and find 'Beej's Guide' to networking. It focuses mainly on *nix systems but will cover Winsock as well.

  12. #12
    Registered User
    Join Date
    Dec 2004
    Posts
    14
    i have windows xp pro sp2

  13. #13
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    And compiler, which compiler are you using?

  14. #14
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    For windows xp you should probably be using WinSock 2. Look at MSDN for sample code and specs.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to program in unix
    By Cpro in forum Linux Programming
    Replies: 21
    Last Post: 02-12-2008, 10:54 AM
  2. FTP problems...
    By gcn_zelda in forum Tech Board
    Replies: 9
    Last Post: 08-03-2004, 11:05 PM
  3. FTP and Ident Server :: Winsock
    By kuphryn in forum Networking/Device Communication
    Replies: 2
    Last Post: 03-13-2004, 08:16 PM
  4. [C++] FTP client problem (winsock)
    By Niekie in forum Networking/Device Communication
    Replies: 2
    Last Post: 10-19-2003, 09:23 AM
  5. FTP Server :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 10-03-2002, 07:14 PM