🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #3490

Re: IdHTTP

#3490
From: Remy Lebeau (TeamB)
Date: Tue, 06 Sep 2005 05:40
37 lines
1934 bytes
"LarryJ" <LarryJ33@ev1.net> wrote in message
news:431b23f9@newsgroups.borland.com...

> I am using the Indy component IdHTTP for the first time. I need to
> download a .csv text file as seen below. After I run the Get( ) how
> do tell IdHTTP to save the file to a specific directory?

By first opening a TFileStream for the desired local file and then passing
that TFileStream to Get() so that it can fill in the local file with the
downloaded data, ie:

    TFileStream *fStream = new TFileStream("c:\\some folder\\table.csv",
fmCreate);
    try
    {
        try
        {

IdHTTP1->Get("http://itable.finance.yahoo.com/table.csv?a=7&b=27&c=2004&d=7&
e=27&f=2005&s=ibm&y=0&g=d&ignore=.csv", fStream);
        }
        __finally
        {
            delete fStream;
        }
    }
    catch(const Exception &)
    {
        DeleteFile("c:\\some folder\\table.cvs");
    }

The version of Get() that you are currently using is returning the
downloaded data as an AnsiString that you are ignoring in your code.


Gambit
Technical Details
Message-ID: <431d2ba5$3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <431b23f9@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,5a21ba55fec022d4
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <431b23f9@newsgroups.borland.com>
Subject: Re: IdHTTP
Date: Mon, 5 Sep 2005 22:40:03 -0700
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <431d2ba5$3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1125985189 68.69.17.41 (5 Sep 2005 22:39:49 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail