I need a cross-platform way to get the current working directory (yes, getcwd does what I want). I thought this might do the trick:
#ifdef _WIN32
#includ
You cannot call getcwd with a NULL buffer. As per the Opengroup:
If buf is a null pointer, the behavior of getcwd() is unspecified.
Also, getcwd can return NULL which can break a string constructor.
You'll need to change that to something like:
char buffer[SIZE];
char *answer = getcwd(buffer, sizeof(buffer));
string s_cwd;
if (answer)
{
s_cwd = answer;
}