Article View: borland.public.cppbuilder.nativeapi
Article #8213Re: How to download a file WITHOUT using the FTP..only through HTTP..
From: Ed Mulroy [TeamB]
Date: Tue, 16 Nov 2004 03:46
Date: Tue, 16 Nov 2004 03:46
84 lines
3247 bytes
3247 bytes
> ...
>Or, more succinctly:
>
>inline const char *ProgramName()
>{ return strrchr(__argv[0], '\\')+1;
>}
> ...
Which, other than formatting, is IDENTICAL to what
I had in the code before. I then thought of how many
times I have been beaten up in messages on here from
people who speak of how '/' also works in path names.
I changed it because some one, some where is likely to
know of the one situation in which '/' would appear in
__argv[0] and I didn't want to get into the '\\' vs '/'
fight again! <g>
. Ed
>Bob Gonder wrote:
>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:
<4199860b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.zanker.org!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41984e1e@newsgroups.borland.com> <41990c0f$1@newsgroups.borland.com> <f89ip09dqme2i01ffueb4jlm3s493n3fdm@4ax.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: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Sender: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Reply-To: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Subject: Re: How to download a file WITHOUT using the FTP..only through HTTP.. Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 24.74.175.102 References: <41984e1e@newsgroups.borland.com> <41990c0f$1@newsgroups.borland.com> <f89ip09dqme2i01ffueb4jlm3s493n3fdm@4ax.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <4199860b$1@newsgroups.borland.com> Date: 15 Nov 2004 20:46:03 -0700 X-Trace: newsgroups.borland.com 1100580363 207.105.83.66 (15 Nov 2004 20:46:03 -0700) Lines: 85 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.zanker.org!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail