🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Paths into URL

#3742
From: Remy Lebeau (TeamB)
Date: Wed, 15 Jun 2005 16:49
24 lines
1559 bytes
"Michele Santucci" <michele.santucci@celinavio.it> wrote in message
news:42b0320e$1@newsgroups.borland.com...

> How can I translate a File Path into an URL?

Look at StringReplace(), ie:

    AnsiString Path = "C:\\Program Files\\MyApp\\Data\\File.txt";
    TReplaceFlags flags = TReplaceFlags() << rfReplaceAll;

    AnsiString Temp = StringReplace(Path.SubString(4, MaxInt), "\\", "/",
flags);
    Temp = StringReplace(Temp, " ", "%20", flags);
    // other conversions as needed..

    AnsiString URL;
    URL.sprintf("file://%c|/%s", Path[1], Temp.c_str());

With that said, why do you need to translate it?  HTTP browsers already
recognize normal file paths.


Gambit
Technical Details
Message-ID: <42b05d9d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42b0320e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,2772c7903ef79719
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: <42b0320e$1@newsgroups.borland.com>
Subject: Re: Paths into URL
Date: Wed, 15 Jun 2005 09:49:35 -0700
Lines: 26
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: <42b05d9d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1118854557 68.69.17.41 (15 Jun 2005 09:55:57 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail