Reputation: 33
I don't know why \a
is not working. My code is working and displays in terminal. My code:
#include <stdio.h>
int main()
{
printf("hello world\a");
return 0;
}
My IDE: Visual Studio Code
My Compiler: Mingw gcc
Upvotes: 2
Views: 1726
Reputation: 26066
The behavior of \a
depends on the environment/terminal you use.
My guess is that Windows does not implement it or perhaps it is disabled for some reason. There is not much you can do unless you use platform-specific APIs that play a specific sound.
See How to make a Beep sound in C on Windows?
Upvotes: 1