I know how to open a file if the name is coded into the source code, but how so I use a user-entered file and path with

ifstream datafile;
datafile.open("x:\\file.dat");

where x:\\file.dat is entered by the user of the program at runtime

thanks