in turbo C++ there is a function called delay(); and in microsoft compiler i guess it is sleep or msleep. what could be the possible equivalent function which can be used when compiling in GCC.

using the looping technique will give different time difference in different machines. is it true?

also i would like to know how to change the text colors.
the turbo c++ offers setcolor/textcolor function. what is the equivalent of it in the GCC.

Recommended Answers

All 5 Replies

Member Avatar for iamthwee

>what could be the possible equivalent function which can be used when compiling in GCC

I guess you could use something from the <ctime> library

Not sure about the colour bit. Using the cursors library maybe?

If using windows: Click

commented: way to go buddy +1

For microsoft windows, the Sleep and SleepEx functions provide delays.

In Linux you can use the usleep function.

I don't know any GCC-specific delay command, nor any portable delay command. If you want to make it portable, you might have to roll your own, or use condition compilation to use a different OS delay function depending on the OS used.

For microsoft windows, the Sleep and SleepEx functions provide delays.

In Linux you can use the usleep function.

I don't know any GCC-specific delay command, nor any portable delay command. If you want to make it portable, you might have to roll your own, or use condition compilation to use a different OS delay function depending on the OS used.

which header files should i include?

If using windows: Click

thank you :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.