How do I get the full filepath of the exe from within the program?

I need the filepath in a char * format.

I've found GetModuleFileName() but it uses a TCHAR which I'm not sure how to convert.
If this is the best way, then I need help on converting TCHAR to char *.

Thanks in advance.
for char*, use GetModuleFileNameA()

TCHAR is WinAPI's way of doing Unicode.

See this: http://cplusplus.com/forum/articles/16820/
Using TCHAR is easy. TCHAR is char if the UNICODE macro name is undefined. If UNICODE is defined, TCHAR is wchar_t.

Similarly, GetModuleFileName() expands to GetModuleFileNameA automatically if UNICODE is not defined, and expands to GetModuleFileNameW() if UNICODE is defined. That simple. You just have to consistently use the TCHAR functions.

On a side note, you should always code UNICODE modules. ANSI is for Windows 95, 98, and Me.
Topic archived. No new replies allowed.