If you are using Boost.Filesystem this code will do it for you:
#include <iostream>
using namespace std;
#include <boost/filesystem/operations.hpp>
namespace bfs = boost::filesystem;
int main(int argc, char** argv)
{
cout << "My full path: " << bfs::current_path().string() << endl;
}
Its tested and it works like a charm. Gotta love boost.
Maybe we should check there implementation? Current_path uses
getcwd on any Unix like platform. On Windows it uses
GetCurrentDirectory. Or since we are using wxWidgets we can use
wxGetCwd in wx/filefn.h. Which I just tested and it works exactly the same.
Both give you the full path from root.
EDIT: BinReloc listed above is cool because it will tell you where libraries and such are too.