I have the following code:
#include
#include
#include
using namespace std;
int main()
{
// Variables
The issue is that you are string to pass an STL string to chdir(). chdir() requires a C Style string, which is just an array of characters terminated with a NUL byte.
What you need to be doing is chdir(sDirectory.c_str()) which will convert it to a C Style string. And also the int on int chdir(sDirectory); isn't necessary.