Article View: borland.public.cppbuilder.nativeapi
Article #17318Re: My Questions.
From: Remy Lebeau (TeamB)
Date: Fri, 28 Mar 2003 23:22
Date: Fri, 28 Mar 2003 23:22
44 lines
2395 bytes
2395 bytes
"Safari" <Safari@alloymail.com> wrote in message
news:3e84cc23@newsgroups.borland.com...
> 1. MyPath = "D:\Program Files\CBuilder\Projects\Project1.exe"
> ExtractFilePath() = "D:\Program Files\CBuilder\Projects\"
> ExtractFileName() = "Project1.exe"
> ExtractFileDrive() = "D:"
> But i want "Program Files\CBuilder\Projects"
As suggested earlier, you would strip off the drive portion returned by
ExtractFileDrive():
AnsiString FilePath = ExtractFilePath(MyPath);
AnsiString FileDrive = ExtractFileDrive(FilePath);
if( !FileDrive.IsEmpty() )
FilePath.Delete(1, FileDrive.Length()+1);
Another possibility, if you can guarantee ahead of time that you're not
using UNC paths, is to use ProcessPath() instead:
char Drive;
AnsiString DirPart;
AnsiString FilePart;
ProcessPath(MyPath, Drive, DirPart, FilePart);
> 2. My String is: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
> My meaning is: Copy(MyString, ???_Start, ???_Length);
> if ???_Start = 10 and ???_Length = 10 then
> My Result is: "JKLMNOPQRS" :-)
Use SubString():
AnsiString MyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
AnsiString MySubStr = MyStr.SubString(10, 10);
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 3/17/03
Technical Details
Message-ID:
<3e84d6c7$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3E847F41.5020409@alloymail.com> <3e84aff5$1@newsgroups.borland.com> <3e84cc23@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,f34eb25907f0e58d X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-03-28 15:18:31 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3E847F41.5020409@alloymail.com> <3e84aff5$1@newsgroups.borland.com> <3e84cc23@newsgroups.borland.com> Subject: Re: My Questions. Date: Fri, 28 Mar 2003 15:22:04 -0800 Lines: 46 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3e84d6c7$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1048893127 207.175.226.26 (28 Mar 2003 15:12:07 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail