I would suggest putting in a call to download it... like perhaps using a system(""...) call where the ""'s contain the ftp... And if you don't want it to take up harddrive space, you could always system("rm filename" later to get rid of it... are you looking to write a browser of sorts? if so why not look at the source for Lynx or Links (yes they are seprate program both I believe are GNU GPL covered software).
Well, I don't know exsactly what you are trying to do, and I'm only familiar with ftp on winDOZE machine, but in DJPPP (G++ for dos, I would actually do it something like this...)
In a batch.bat file:
ftp -s:file.txt server.com
In file.txt (exsactly what you'd type at the ftp prompt):
login <--login name
passwd <--pass word
lcd c:\pf
get mfile
bye
In CPP:
int main()
{
system("batch.bat"
ifstrea fin;
fin.open("mfile"
vector<char> buf;
while( !cin.eof() )
{
char ch;
cin>> noskipws >> ch;
buf.push_back(ch);
}
. . .
That of course is a cheap work around... and if I needed to get diffrent files from munlitple servers I'd use the file stream to write to file.txt and leave off the host in the batch file, or use the line in the batch as the thing between the quotes in the system. rember that system, noskipws, vector and filestrea all require included libraries.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.