Article View: borland.public.cppbuilder.nativeapi
Article #8209Re: How to download a file WITHOUT using the FTP..only through HTTP..
From: Bob Gonder
Date: Mon, 15 Nov 2004 23:00
Date: Mon, 15 Nov 2004 23:00
59 lines
2528 bytes
2528 bytes
Ed Mulroy [TeamB] wrote:
>inline const char *ProgramName()
> {
> char *arg0 = __argv[0];
> char *s = strrchr(arg0, '\\');
> if (!s)
> s = strrchr(arg0, '/');
> if (s)
> ++s;
> else
> s = arg0;
>
> return s;
> } // end ProgramName
What if the program was started as \\server\disk/dir/program.exe
Hmm... they might also start it with X:program.exe
Rats...Windows translates everything and gives proper '\' everywhere.
Wonder why you had the extra test for '/' ?
Is that for 'nix portablility?
inline const char *ProgramName()
{
char *arg0 = __argv[0];
char *s = strrchr(arg0, '\\');
/* Windows fixes these 'problems'
char *t = strrchr(arg0, '/');
if( t > s ) s = t;
t = strrchr(arg0, ':');
if( t > s ) s = t;
*/
return s? ++s: arg0;
}
Or, more succinctly:
inline const char *ProgramName()
{ return strrchr(__argv[0], '\\')+1;
}
Maybe there's documentation somewhere that says this isn't guaranteed?
> handle =
> InternetOpen(
> pname,
> INTERNET_OPEN_TYPE_PRECONFIG,
> NULL,
> NULL,
> 0);
Yeah, I like that better than what I had....
InternetOpen(
"Microsoft Internet Explorer", // agent
INTERNET_OPEN_TYPE_PROXY, // access
"ftp-gw", // proxy
NULL, // defaults
0)) ) // synchronous
And the Ftp functions still work!
Technical Details
Message-ID:
<f89ip09dqme2i01ffueb4jlm3s493n3fdm@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!newsprint.newsread.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<41984e1e@newsgroups.borland.com> <41990c0f$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f57c5862d590fb6d X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: How to download a file WITHOUT using the FTP..only through HTTP.. Date: Mon, 15 Nov 2004 15:00:35 -0800 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <f89ip09dqme2i01ffueb4jlm3s493n3fdm@4ax.com> References: <41984e1e@newsgroups.borland.com> <41990c0f$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.77.147.16 X-Trace: newsgroups.borland.com 1100559634 67.77.147.16 (15 Nov 2004 15:00:34 -0700) Lines: 62 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!newsprint.newsread.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail