Hello, I am trying to create a simple program that gets a file path from the user, stores it in a variable and then a function such as mciSendString or ShellExecute can use to know what file to play or launch.
I am finding a difficulty implementing this tactic.
The following shows a stripped down version of what I am trying to do:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
#include <string>
#include <Windows.h>
usingnamespace std;
string FilePath; //The File path variable
cout << "Enter the file path: \n";
cin >> FilePath; //Accepting a file path from a user
mciSendString("open FilePath", NULL, 0, 0); //Plays the music file
fflush(stdin); //Pauses the program
getchar();
return 0;
Any help would be greatly appreciated regarding this matter.