Jump to content

Character seven


NeonBlack

Recommended Posts

If you try to "print" ACSII character seven like

 

cout << (char) 7;

You get a little beep that actually comes from inside your computer. I have never seen any sort of internal microphone on the inside of any computer.

What is the purpose of this character and where does the beep come from?

Link to comment
Share on other sites

There's a little speaker in there. It's connected directly to the motherboard. Back in the early days of Windows (and latter days of MS-DOS), when sound cards were still expensive, there were various software approaches to try to eek performance out of those speakers. It never really worked all that well, and for the most part the little thing's been more or less forgotten. Good questions for the A+ exam, but that's about it.

 

It does have one piece of useful functionality. It beeps when you turn your computer on (you've heard it a thousand times, but you probably thought it was the multimedia speakers making the noise). What's useful about it is that it gives you an initial indication that the system is functioning. If there were a problem with, for example, the video card, it would beep three times. It's helpful when you're troubleshooting a hardware problem. But things are so cheap now, and it's so common to get most of the peripherals already built into the motherboard, that it's not really all that useful anymore.

Link to comment
Share on other sites

no, you don't understand. write a simple 'Hello World' program, but instead of 'hello world' print ASCII character 7. Compile it and run it. Character 7 is a beep. There is nothing 'wrong' and there is no error.

Link to comment
Share on other sites

no, you don't understand. write a simple 'Hello World' program, but instead of 'hello world' print ASCII character 7. Compile it and run it. Character 7 is a beep.[/u'] There is nothing 'wrong' and there is no error.

 

Oh, sorry. I thought you were asking something different. I am not that great with C++. C is my forte. But yeah, the speaker is more of a way to know whats going wrong in the computer. And you know the "/a" causes it to sound in C and I am sure C++ too right?

Link to comment
Share on other sites

I know nothing of /a.

But it works the same in C as in C++ just instead do

 printf ("%c", 7);

if you want to try it.

 

Oh yeah, if you really want to annoy your friends, try something like

int x = 1;
do
{
cout << (char) 7;
} while (x == 1);

 

and get them to run it. Change a desktop shortcut, I don't know. :P

Funny, and there's no harm in it.

Link to comment
Share on other sites

Chr 7 is specified as beep in the ASCII system. It belongs in a group of other characters like Chr 2 (enable printer) or Chr 13 (new line). These are not displayable characters but cause something to happen.

Link to comment
Share on other sites

Chr 7 is specified[/i'] as beep in the ASCII system. It belongs in a group of other characters like Chr 2 (enable printer) or Chr 13 (new line). These are not displayable characters but cause something to happen.

 

 

Yep. Here's a look at the ASCII chart for anyone who is interested (this is the extended 8-bit ASCII set, whereas the default older one was only 7-bit (ie Just table I)).

 

ASCII Table

 

Wiki on ASCII

 

 

 

Ended up playing alot with ordinal character/ASCII values for my Computing project when i wrote myself a nicer read/readln() procedure for my Turbo Pascal Project. Was fun :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.