Reply
Thu 4 Jan, 2007 08:04 am
When you are using a word processor, what happens to make a letter 'T' appear on the screen when you press the button labelled 'T' on your key board?
This is a question I must answer as an oral presentation for entrance into a teaching course. I would be most grateful if anyone had any idea or could point me to any relevant resources.
Many thanks.
A word processor basically runs a loop reading forever from the standard input, i.e. the keyboard. It interprets the keycode in ASCII format to decide what to display on the screen. A "t" is 1010100. The output is sent to standard out, in this case, the screen.
Or you could just make something up. Nobody really knows how these things work.
I'd just like to say that the thread author's screen name is the most replusive thing I've read since BlueVeinedThrobber went back to being Bi-Polar Bear.
actually... that's not really the best description of how this works. a keyboard is hardware driven by the bios. the word processor doesn't poll the keyboard specifically. when a key is pressed, it sends an event message to the operating system. the OS decodes the message and dispatches it to the correct program. this raises an even function in the program and it acts accordingly, in this case, simply displaying the character on the screen (which is *not* standard out).
So what would be standard out?
What is the purpose of this (Perl) if you don't read directly from the keyboard (from a programmers perspective)?
$input=<STDIN>;
chop($name);
I think many educators would be lucky to find the "any key".
being a programmer myself, standard out usually refers to a console terminal (the command prompt screen). and standard is in input from there as well.
Does it really matter? Did we question how T's were made back in the typewriter days? Let's just be glad that the WP DOES make T's so we can all share our T's with our families and friends!