Hi i would like to ask if there is any way to play a sound from cmd.Not to execute the file with other programm through cmd..i would like to be something like Beep but a sound file
Yes. However, you'll need some other library to do so (or just do it the hard way and go directly through MIDI). On some operating systems, its easier than others. Here is an example for Windows (assuming a WAV file):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <windows.h>
#include <mmsystem.h>
#include <iostream>
int main() {
// play a sound
PlaySound(TEXT("filename.wav"), NULL, SND_ASYNC | SND_FILENAME | SND_LOOP);
// do things here
// program finish, wait for <ENTER> and then stop the sound and exit
std::cin.sync();
std::cin.get();
PlaySound(NULL, NULL, 0);
return 0;
}