Re: thread.sleep() for c++?

I use thread.sleep() and a counter in java to run a for loop as many times as seconds that the user asked the timer to run for. At the end I print the character \007 which makes the pc speaker beep, I guess it is the Unicode bell character. I want to convert this program to c++ for Windows so I can use the beep() function of c++ but am much better in java than c++ so, even better than converting to c++, was wondering if there is a way of accessing the pc speaker with a function in java and, like the c++ one, passing it a frequency in hertz and a duration and having the pc speaker sound at that frequency and for that duration. So basically I either want to use a function similar to thread.sleep but for c++, coding for Windows, or (even better) have access to the pc speaker through java and be able to pass a frequency and duration for a tone in java.


Have a great day,
Alex

----- Original Message -----
From: "Marlon Brandão de Sousa" <splyt.lists@xxxxxxxxx
To: programmingblind@xxxxxxxxxxxxx
Date sent: Sat, 16 Feb 2008 01:55:48 -0300
Subject: Re: thread.sleep() for c++?

Hello,
Well, C or c++ doesn't present a built in library to manage
threads.
This means you will need to access the operating system native
functions to manage them, and this is different in each OS.
There are
OS that even don't support threads, so if you are using one of
them
you will have to figure how to simulate it, although modern
operating
systems like windows and most ports of unix for most part of
platforms
have it. If you can give more dtails we can provide help on how
to do
it.
About the beep function, where was one in borland turbo c++ for
DOS,
long time ago. I don't know if it still works, but it shouldn't
be
hard to build one ...
Marlon

2008/2/15, Alex Hall <mehgcap@xxxxxxx>:
I have a java timer that I made out of bordum.  It uses
thread.sleep() to run for the input time.  I really want to use
the pc speaker and the beep() function in c++. Is there a
method
I can call in a c++ program similar to Java's thread.sleep()?
Even better, is there some way of using a method like beep() in
Java?

Have a great day,
Alex
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind




--
When you say "I wrote a program that crashed Windows," people
just
stare at you blankly and say "Hey, I got those with the system,
for
free."
Linus Torvalds
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind



__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind

Other related posts: