Strange beep when using cout

today, when I was working on some code, I came across a beep when printing a buffer to the screen. Here's a mysterious character that beeps: I don't know if you see this, but my computer beeps when I try to print it like this:

cout<<(char)7<<endl;

Another interesting topic is that the "sound signal" does not come from my onboard beeper, but from the headphones / speakers

Is it just my computer or is there something wrong with the cout function?

EDIT:

But then why printing this symbol creates a sound signal? Does this mean that I could send other such characters through the cout function to create different effects?

+5
source share
4 answers

In ASCII, character 7 is the bell symbol that signals the terminal that it should sound.

EDIT: To answer your next question, this is valid only for historical reasons. Old teletype terminals needed a way to notify the operator of an incoming message in order to use the bell. The bell symbol told the terminal to ring the bell and not print the symbol.

Modern terminal emulators perform almost the same thing, although usually they have the ability to replace a sound call with a visual one.

+12
source

0x7 - ASCII, "bleep". . ASCII : http://www.asciitable.com/

: . , . , 0x20 (32 ), , . , .

, 0- ( ), , .

+12

char 7 - ASCII BELL. , . .

+3

chat 7 is actually a beep character, not a screen character. Although documentation may sometimes show a character, this is usually not something you can visually visualize.

+3
source

All Articles