Sorry to keep hammering on this, but I\'m trying to learn :). Is this any good? And yes, I care about memory leaks. I can\'t find a decent way of preallocating the char*, be
When "string constructor" do everything for you:
#include // defines FILENAME_MAX #include // for getcwd() std::string GetCurrentWorkingDir() { std::string cwd("\0",FILENAME_MAX+1); return getcwd(&cwd[0],cwd.capacity()); }