system() call in C

410 views Asked by At

I am writing my C code in Visual Studio and Im using the system() function in C to call wmplayer and play a sound:

system("C:\\Windows_Media_Player\\wmplayer C:\\Users\\lfanning\\Downloads\\sound .wma");

I call this in the middle of my main function however when I call it my program stops here and does not continue on with the next step.

How could I solve this?

1

There are 1 answers

2
Kamalesh Wankhede On

Try writing it as follows

system("\"C:\Windows_Media_Player\wmplayer\" \"C:\Users\lfanning\Downloads\sound .wma\"");

Edit: Write it in a way that produces resulting string as "C:\Windows_Media_Player\wmplayer" "C:\Users\lfanning\Downloads\sound.wma" with quotes