Strange beep when using cout

前端 未结 4 1667
北海茫月
北海茫月 2021-01-18 19:41

today when I was working on some code of mine I came across a beeping sound when printing a buffer to the screen. Here\'s the mysterious character that produces the beep: \'

4条回答
  •  無奈伤痛
    2021-01-18 19:53

    0x7 is the ASCII character that produces a 'bleep' sound. It is a non-printable character. Here is a full list of the ASCII characters and their codes: http://www.asciitable.com/

    Edit: The sound can be used for a veritable melange of things. However you cannot really produce other effects by sending other pieces of data through. In the table in the link above anything on the list below 0x20 (32 decimal) is a non-printable character. They can have different effects depending on where the data is actually output.

    Basically you could just write a loop to output 0-(whatever number you wish to stop at) to experiment and see what you can get.

提交回复
热议问题