Article View: borland.public.cppbuilder.nativeapi
Article #16847Re: How to Get the ExeName and Fie Path from a filename
From: Remy Lebeau (TeamB)
Date: Tue, 22 Apr 2003 06:45
Date: Tue, 22 Apr 2003 06:45
21 lines
1831 bytes
1831 bytes
"Sky" <akeehuang@163.net> wrote in message
news:3ea4ce4d@newsgroups.borland.com...
> if there is no command line parameter,
> GetCommandLine() return the completed filename,
> but how to parse if there is some command line parameter.
> for example: C:\temp\test.exe /u /c /l
> how to extract the path and pure filename in this case.
If all you want is the filename of the module that is being executed,
regardless of the command line parameters passed to it, then have a look at
simply calling GetModuleFileName() instead of trying to parse the return
value of GetCommandLine():
char filename[MAX_PATH+1] = {0};
GetModuleFileName(NULL, filename, MAX_PATH);
// use filename as needed
Gambit
Technical Details
Message-ID:
<3ea4e4fe$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!216.166.71.118.MISMATCH!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ea4a7ff@newsgroups.borland.com> <3ea4b181$1@newsgroups.borland.com> <3ea4ce4d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,54d84ada88133a7e X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-04-21 23:52:45 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ea4a7ff@newsgroups.borland.com> <3ea4b181$1@newsgroups.borland.com> <3ea4ce4d@newsgroups.borland.com> Subject: Re: How to Get the ExeName and Fie Path from a filename Date: Mon, 21 Apr 2003 23:45:54 -0700 Lines: 23 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: <3ea4e4fe$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1050993918 207.175.226.26 (21 Apr 2003 23:45:18 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!216.166.71.118.MISMATCH!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail