Přidat otázku mezi oblíbenéZasílat nové odpovědi e-mailem Umístění souboru v C++

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:
http://www.cplusplus.com/forum/general/11104/

Reakce na odpověď

1 Zadajte svou přezdívku:
2 Napište svou odpověď:
3 Pokud chcete dostat ban, zadejte libovolný text:

Zpět do poradny