Работа с файлами / Базовые операции

#include "stdafx.h"
#ifdef linux
#include <unistd.h>
#define GetCurrentDir getcwd
#else
#include <direct.h>
#define GetCurrentDir _getcwd
#endif


char workPath[FILENAME_MAX];

if (!GetCurrentDir(workPath, sizeof(workPath))) {
    throw "could not find directory";
}

std::cout << workPath;