🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages Started by Sky Tue, 22 Apr 2003 02:24
How to Get the ExeName and Fie Path from a filename
#16842
Author: Sky
Date: Tue, 22 Apr 2003 02:24
8 lines
1221 bytes
Hi all, I want get the ExeName and file path from a string with API,
I know ExtractFilePath and ExtractFileName in BCB,
Is there a API and do that?
the string has been retrieve by GetCommandLine(),
it maybe include other command parameter.
TIA

Sky
Re: How to Get the ExeName and Fie Path from a filename
#16843
Author: Remy Lebeau (TeamB)
Date: Tue, 22 Apr 2003 03:05
12 lines
1295 bytes
"Sky" <akeehuang@163.net> wrote in message
news:3ea4a7ff@newsgroups.borland.com...
> Hi all, I want get the ExeName and file path from a
> string with API, I know ExtractFilePath and
> ExtractFileName in BCB, Is there a API and do that?

No.  The VCL has to parse the filename manually.  So will you, if you don't
want to use the VCL functions.


Gambit
Re: How to Get the ExeName and Fie Path from a filename
#16845
Author: Sky
Date: Tue, 22 Apr 2003 05:08
16 lines
1649 bytes
> > Hi all, I want get the ExeName and file path from a
> > string with API, I know ExtractFilePath and
> > ExtractFileName in BCB, Is there a API and do that?
>
> No.  The VCL has to parse the filename manually.

Hi Remy, thank you,
but could you tell me how to parse the filename manually,
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.
TIA

Sky
Re: How to Get the ExeName and Fie Path from a filename
#16847
Author: Remy Lebeau (TeamB)
Date: Tue, 22 Apr 2003 06:45
21 lines
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
Re: How to Get the ExeName and Fie Path from a filename
#16854
Author: Sky
Date: Tue, 22 Apr 2003 13:46
1 lines
1091 bytes
Thank you.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads