I posted an earlier question and got no answers, which really is BS. so ima try again...

I am trying to make a console program that can create a text document, and send it over ftp.

thats it, I would like it if someone could point me in the right direction...

Member Avatar for 1stDAN
commented: no -2
Member Avatar for iamthwee

cp means what?

Member Avatar for 1stDAN

Sorry ZlapX, what was wrong with my posting?

Why do you vote me minus?

I really meant the site I suggested seriously! I often copy code from there. There you can find complete solution for ftp transfer!

So you are really unfair guy!

cp means what?

copy and paste.. =)

Sorry ZlapX, what was wrong with my posting?

Why do you vote me minus?

I really meant the site I suggested seriously! I often copy code from there. There you can find complete solution for ftp transfer!

So you are really unfair guy!

I did not vote you minus nor do i know how to do that, i looked at the site and found nothing also... i will look again..

if i could i would of upped or added or whatever you call it on your answer. must of been some other dude.

Member Avatar for 1stDAN

Dear ZlapX

meantime i talked with my friend how invited me to join daniweb. He said that I have been given 3 times minus by anybody. And you were not able to jugde me 3 times minus. Therefore this unfair judgement must have been done by other guy. My friend said that I now have lost my green point for positive and my read point for negative votes due to this bad jugdement.


Now I am sure, you are not that bad guy.

I do apologize for my wrong suspicion.

I really meant seriously when I cited example-code site:

http://www.example-code.com/vcpp/ftp_upload.asp


Here is the ftp code I mentioned:

#include <CkFtp2.h>
#include <CkString.h>

void ChilkatSample(void)
    {
    CkFtp2 ftp;

    bool success;

    //  Any string unlocks the component for the 1st 30-days.
    success = ftp.UnlockComponent("Anything for 30-day trial");
    if (success != true) {
        printf("%s\n",ftp.lastErrorText());
        return;
    }

    ftp.put_Hostname("ftp.chilkatsoft.com");
    ftp.put_Username("****");
    ftp.put_Password("****");

    //  The default data transfer mode is "Active" as opposed to "Passive".

    //  Connect and login to the FTP server.
    success = ftp.Connect();
    if (success != true) {
        printf("%s\n",ftp.lastErrorText());
        return;
    }

    //  Change to the remote directory where the file will be uploaded.
    success = ftp.ChangeRemoteDir("junk");
    if (success != true) {
        printf("%s\n",ftp.lastErrorText());
        return;
    }

    //  Upload a file.
    CkString localFilename;
    localFilename = "hamlet.xml";
    CkString remoteFilename;
    remoteFilename = "hamlet.xml";

    success = ftp.PutFile(localFilename,remoteFilename);
    if (success != true) {
        printf("%s\n",ftp.lastErrorText());
        return;
    }

    ftp.Disconnect();

    printf("File Uploaded!\n");
    }

Ok, maybe this code isn't suitable for you. I myself have copied very good code from this site.

I can't really understand what is wrong with my citation.

I say sorry again.

commented: You're back up rep-wise +11

To 1stDan,

Voting and rep are entirely subjective. You can't find out who down-voted you, but you can find out who gave you bad rep by going to your control panel. Perhaps the person who down-voted you felt that you should have posted a specific link originally rather than just a link to the overall website. I don't know. I up-voted and up-repped you to even things out. You had positive rep before I did, but now you have more.

To the OP,

I'd say you didn't get a response to your first post because it was too vague and/or no one reading the forum was familiar with the specifics of what you were trying to do. You should also link the thread you are referring to.

There are two distinct parts to your question: the ftp part and the text document part. For the ftp part, not knowing the specifics, I guess I'd go with iamthwee's suggestion and use curl. You can either use curl.exe and execute it from a C++ program using execvp or whatever, or you can use libcurl: http://www.libcurl.org/ from the C++ program.

It's definitely more complicated than copying and pasting it into your C++ project. You need to read the API, know how to link it, know what the other end expects, etc. etc. Might be a piece of cake, might not.

Or 1stDan's code might work for you. I'm not familiar with those libraries.

To 1stDan,

Voting and rep are entirely subjective. You can't find out who down-voted you, but you can find out who gave you bad rep by going to your control panel. Perhaps the person who down-voted you felt that you should have posted a specific link originally rather than just a link to the overall website. I don't know. I up-voted and up-repped you to even things out. You had positive rep before I did, but now you have more.

To the OP,

I'd say you didn't get a response to your first post because it was too vague and/or no one reading the forum was familiar with the specifics of what you were trying to do. You should also link the thread you are referring to.

There are two distinct parts to your question: the ftp part and the text document part. For the ftp part, not knowing the specifics, I guess I'd go with iamthwee's suggestion and use curl. You can either use curl.exe and execute it from a C++ program using execvp or whatever, or you can use libcurl: http://www.libcurl.org/ from the C++ program.

It's definitely more complicated than copying and pasting it into your C++ project. You need to read the API, know how to link it, know what the other end expects, etc. etc. Might be a piece of cake, might not.

Or 1stDan's code might work for you. I'm not familiar with those libraries.

I voted him up as soon as i saw... I hope i didn't actually randomly click down, If i did, i voted up to fix it. lol

Hey dan1, the code gave me a error

#include <CkFtp2.h>
#include <CkString.h>

it says i don't have those files.. care to help?

OK, everyone i need this to run without the user knowing... i hope curl can help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.