I have to display the message only for a specific time. After that it should be erased from the display. how to do this program in c.

Re: timer in c 80 80

this i wrote for linux what is your platform ? my ubuntu - gcc

#include <time.h>
#include <stdio.h>

int main()
{
   time_t startSeconds;

   startSeconds = time(NULL);

   while(1)
   {
      system("clear");//platform specific check your platform this is linux/unix
      printf("%ld \n", time(NULL) - startSeconds);
      sleep(1);//platform specific check your platform and change this is linux/unix
   }
   return 0;
}
Be a part of the DaniWeb community

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