cbeep

Unable to get system beep to work in C using various methods


I have tried \a \7 the windows.h beep function etc etc and nothing works.

Does newer hardware not have this functionality built in?

(Console Program)


Solution

  • In C, printf("\a") should generate an alarm. To the best of my knowledge, this is done through the PC speaker. In modern systems, there is no hardware PC speaker. It's sometimes emulated by your soundcard, but that's OS and driver specific. In short, you might be out of luck.

    You can try MessageBeep(): http://msdn.microsoft.com/en-us/library/ms680356(VS.85).aspx.

    Good luck.

    Also, you should check all the usual culprits like your sound card being muted, speakers plugged/not plugged in, etc.