I'm very new at C++ and would like to know how I would change a directory via user input? This will be a Win32 Project and not a Win32 application.

I know I can use (as standard - and without user input) the chdir("\\dir"); - but how do I use this with user input?

Thanks in advance! :)

usethe string header so you can get the path from the user then pass it to chdir like this



Thanks for your reply!!

Sorry if I am being thick, but is this correct (some of the script has been removed)?

#include <string.h>

using namespace std;

string entry;

cout << "1. Enter FULL PATH to directory: ";
cin >> entry;



	return 0;

Thanks again for your help!


Thank you very much for that. It now works!!!!


string user;
string entry;

cout << "2. Enter FULL PATH to DIR: ";
cin >> entry;

user = entry;


Thanks for your help!!!!!!!

This question has already been answered. Start a new discussion instead.