Předmět Autor Datum
Windows: #include <string> #include <windows.h> std::string getexepath() { char result[ MAX_PATH ];… poslední
Flash_Gordon 03.07.2012 09:55
Flash_Gordon

Windows:

#include <string>
#include <windows.h>

std::string getexepath()
  {
  char result[ MAX_PATH ];
  return std::string( result, GetModuleFileName( NULL, result, MAX_PATH ) );
  }

Linux:

#include <string>
#include <limits.h>
#include <unistd.h>

std::string getexepath()
  {
  char result[ PATH_MAX ];
  ssize_t count = readlink( "/proc/self/exe", result, PATH_MAX );
  return std::string( result, (count > 0) ? count : 0 );
  }

Zdroj:
11104

Zpět do poradny Odpovědět na původní otázku Nahoru