March 27th, 2003, 06:05 PM
I'm writing a program in C to get the computers internal speaker to transmit a morse code message.
I have no problem transmitting a dot, I use the \a command inside of printf, but I can't repersent a dash, (three times the length of a dot). I've tried using \a three times in a row but it doesn't sound right so I was wondering does anybody know how I might achieve this.
Also is there a command to stop a program operating for a length of time (such a sleep command or something) to put the spaces in the message?
Thanks in advance,
If you don\'t learn the rules nobody can accuse of cheating.
March 27th, 2003, 08:47 PM
stop a program operating for a length of time -
sleep( time_t timeout_in_seconds )
bet you didn't see that comin', but i don't like it because it tends to act differently for different computers because it is only as accurate as the system clock.
msleep( long timeout_in_miliseconds )
usleep( unsigned long timeout_in_microseconds )
for windows C++ heads, it seems to be
Sleep( int timeout_in_seconds )
and you also have to #include <windows.h>. they all return int's
there are functions in the <sound.h> for messing with the built in speaker.
//must have IBMPC compatible hardware and software
sound_beep( int frequency )
sound_tone( int cycles, int uptime, int dntime )
Hmm...theres something a little peculiar here. Oh i see what it is! the sentence is talking about itself! do you see that? what do you mean? sentences can\'t talk! No, but they REFER to things, and this one refers directly-unambigeously-unmistakably-to the very sentence which it is!
March 30th, 2003, 10:25 AM
You might try using an ASCII code a'la ...
for your long dash. I can't remember what it was that
I needed the same thing for a while back, but using
the ASCII decimal ( or Hex ) code truned out to be
the easiest way to get what I wanted, and it made
iterration a lot easier too.
Get OpenSolaris http://www.opensolaris.org/