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

cout<<"Please enter the file name";
cout<<"Do you want to open the file? [yes] or [no]"<<endl;
system("C:\\wmplayer.exe fname");
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

Recommended Answers

All 6 Replies

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

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

So then ill have

char *fileopen;


Anyone else has a suggestion?

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

duplicate thread. See answer here

Thread closed!

Please follow any further discussion here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.