0

Hey guys. Im trying to open a file the user entered.

cout<<"Please enter the file name";
cin>>name;
cout<<"Do you want to open the file? [yes] or [no]"<<endl;
cin>>pick;
if(pick=="yes")			
system("C:\\wmplayer.exe fname");
else 
cout<<"Good bye";

How do i get the value thats in fname to be printed their so it can open the file.
Lets say the value of fname was movie.avi. The user entered movie.avi and fname is a string that stores that value

4
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by peter_budo
0

Concatenate "C:\\wmplayer.exe " and fname into a char* and use that variable.

So then ill have

char *fileopen;
fileopen=&fname;

?

0

Im not understanding what walt wants me to do. If i point the char to the string its gong to give me an error. Can someone else please give me another suggestion been trying to work something out for hours. The entire code im trying to build is complete but this part is giving me hell

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.