I'm studying C++, using bash, and the Escape Sequences. I'm trying to do a lot of exercises to better memorize them. Now, the \a should produce a sound, like a beep.
I'm using the following code, but it seems \a doesn't work:
#include <iostream>
using namespace std;
int main ()
{
cout << "\a";
return 0;
}
Did I make any mistake? I'm only using it like the \n sequence, is this wrong? Thanks!
New details: I discovered it works on the terminal, but it doesn't work in the built-in terminal in Kate.
OS: I use Ubuntu as a guest Os using Windows 7 as host with VirtualBox. I'll post the version soon.
Whether \a produces a beep or not depends on where you write it. If you run this program in a Unix terminal you'll probably get a sound. If you use an IDE or a GUI terminal emulator it might happen that you won't see or hear anything.
If you specify which terminal you're using (gnome-terminal? Apple Terminal.app?) someone might help you configuring it to play a sound...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With