I want to get the current executable application name of my windows console application. According to this answer, the solution should be to use GetModuleFileNameA function.
The problem is the function doesn't fill the name of the executable but fill the address :
#include <iostream>
#include <tchar.h>
#include <windows.h>
int main()
{
TCHAR szFileName[MAX_PATH];
GetModuleFileName(NULL, szFileName, MAX_PATH);
std::cout << "My executable name is : " << szFileName << std::endl;
system("pause");
}
Output : My executable name is : 0077F9DC
Some one could fix my code ?