What difference is there (if any) between these two? MSDN is very unclear.
Here it sounds like they are equivalent: https://msdn.microsoft.com/en-us/library/windows/desktop/ms683197%28v=vs.85%29.aspx
But here it sounds like _pgmptr may not always give me a full path, but it doesn't really explain under what circumstances. https://msdn.microsoft.com/en-us/library/tza1y5f7.aspx
_pgmptr Seems far more attractive to me because I don't have to play buffer size guessing games with it.
_pgmptr is initialised using GetModuleFileName internally, so the answer is there's no difference - they will return the same string.
There at least one difference: _get_pgmptr() isn't available early in an application initialization, whilst GetModuleFileName() is. I've just been bitten by the Static Initialization Order Fiasco because of this :(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With