rsethc
rsethc

Reputation: 2684

What happened to _pgmptr?

I have always used _pgmptr, which was a char* provided by Windows that gave the exact full path of the executable. However, after recently updating MinGW it seems to be defined to NULL instead. Is there any other way to get the full executable path, with out without its name (like instead of C:\program.exe just C:\ would be okay for what I'm doing)?

I'm fine with a platform-independent way or Windows-specific way, as long as it is reliable.

Upvotes: 4

Views: 2988

Answers (1)

Joey
Joey

Reputation: 354744

GetModuleFileName is the API function to retrieve the program path and name.

Upvotes: 6

Related Questions