🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13268

Re: GetPartialFileName

#13268
From: Bob Gonder
Date: Fri, 17 Oct 2003 18:52
22 lines
1505 bytes
Stephane Baillargeon wrote:

>Is there a function in the WinAPI that can give me the filename part and
>leave behind the directory?
>
>Ex:
>
>"C:\Path1\Path2\Filename.fil"
>to this
>"Filename.fil"
>
>I know I can parse the string (substr) and hard code it myself but if
>there's already something in the WinAPI, why bother :)

Is there some reason not to use fnsplit()?

char filename[MAXPATH];
char name[MAXFILE];
char ext[MAXEXT];

fnsplit( "C:\Path1\Path2\Filename.fil", NULL, NULL, name, ext);
fnmerge( filename,NULL,NULL,name,ext);
Technical Details
Message-ID: <hce0pvgfoqi1k36his69gapo2s71v0n93q@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f8f7e6f@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,5015eee32f4897a5
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-17 12:08:35 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: GetPartialFileName
Date: Fri, 17 Oct 2003 11:52:23 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <hce0pvgfoqi1k36his69gapo2s71v0n93q@4ax.com>
References: <3f8f7e6f@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.165.14
X-Trace: newsgroups.borland.com 1066416742 67.31.165.14 (17 Oct 2003 11:52:22 -0700)
Lines: 24
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail