how to retrieve the absolute path of exe in C

S

somank.sharma

Hi All,

I am running an exe which is written in C. In the main method of this
exe I am getting the exe name as the first argument argv[0], I want
the full path of this exe. How can I retrieve this?
Any help would be greatly appreciated.

- Darshi
 
J

John Harrison

Hi All,

I am running an exe which is written in C.

This group is comp.lang.c++. You should ask C questions in comp.lang.c

In the main method of this
exe I am getting the exe name as the first argument argv[0], I want
the full path of this exe. How can I retrieve this?
Any help would be greatly appreciated.

There is no way to do this in standard C++ (or standard C I think).

You need some platform specific API, and we can't help you about that
here. Ask on a group that deals with your platform. If you are
programming Windows then try

comp.os.ms-windows.programmer.win32

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top