Re: How To Implement Timer in C



"achiever" <friends.vikram@xxxxxxxxx> wrote:

On Feb 27, 9:15 pm, "UG" <unmeshgh...@xxxxxxxxx> wrote:
I just wanted to know whether any timer facility exists in C, as it is
not mentioned in K&R 2, or in the ISO Draft. By timer function i mean
that when we use standard input function like scanf() or getch() or
any other function, the interface stops to take input from user but
what if user doesn't give input for hours, the program will still be
waiting. Is there any way to circumvent the scanf() (or any other
input function for that matter) so that it takes some default input or
no input and just proceeds to the next line of the execution assuming
input from user as nothing and acts accordingly.

yes their exists a time delaying facility under c

No, there doesn't.

the *delay()* function which delay the output on the the screen

....does not exist in C.

the time of declared in side bracesthis function is defined in dos.h

....which also does not exist in C.

Your toy compiler may include it, but that doesn't mean it will work on
a real computer. Especially when it's called "dos.h".

Richard
.



Relevant Pages

  • Re: "directory order" - K and R 2 exercise 5-16?
    ... > scanf whatsoever. ... unsafe input, and the only way to get unsafe input is from the user, ... via 'getchar', 'scanf', or any other input function. ...
    (comp.lang.c)
  • Re: How To Implement Timer in C
    ... By timer function i mean ... Is there any way to circumvent the scanf() (or any other ... input function for that matter) so that it takes some default input or ...
    (comp.lang.c)
  • Re: Usage of scanf to prevent buffer overflow...
    ... > In one of my posts, someone tell me that is more secure use input function ... secure input choice. ... scanf() is no problem when used ... correctly, i.e., _with_ a field specifier. ...
    (comp.lang.c)
  • Re: print binary
    ... returned by the input function. ... An input sequence that would cause overflow upon assignment would break ... In this case undefined behaviour is invoked, which means that scanf ...
    (comp.lang.c)
  • Re: How To Implement Timer in C
    ... that when we use standard input function like scanfor getch() or ... Is there any way to circumvent the scanf() (or any other ... input function for that matter) so that it takes some default input or ... Many platforms provide timer, such as win32, in which you can use func ...
    (comp.lang.c)