0

I just started learning C++, and I came across an escape sequence that must make a beep. When I compile it and run, i don't hear a beep for some reason. Here is the code:

#include <iostream>
using namespace std;

int main(){
  cout << "Cool\a\nHey man!\n";
  return 0;
}

The sequence \a doesn't work. Any help would be appreciated. Thanks!

4

1 に答える 1

0

それと同等のものが私のために働いています。まず、端末のビープ音は機能していますか? それをテストするのは難しいかもしれません。printf '\a'コマンドラインから試すことができます。

また、16 進ダンプ ツールを使用して出力を実行してみてください。これらのいずれかがうまくいくはずです:

xxd
od -tx1

ベルが値 7 の文字として出てくることを確認します。

于 2013-08-27T04:11:57.803 に答える