I have written a program in which there is a board and the balls should travel from one place to another.i need to provide a delay when i draw the ball in new position and erase it from previous position.I used delay() funtion on turbo c++.but on gcc compiler on linux i dont know how to provide delay.I used usleep() function but i cant see the successive movement of balls.what should i do?.please help..how do i write a delay loop

Recommended Answers

All 4 Replies

// call :

system("pause"); // ||  system(pause);

// maybe..

You can make your program to sleep

This link may be useful

Well did you take account of the fact that usleep takes MICROSECONDS?

delay(1000); and usleep(1000); will wait for different times.

@salem
yes i have given in terms of micro seconds only.
@prabhakar
link was useful!

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.