Like Tree1Likes
  • 1 Post By grumpy

How to use delay() in another function?

This is a discussion on How to use delay() in another function? within the C Programming forums, part of the General Programming Boards category; Im using C with header file dos.h where delay() function works correctly in main function but when I use delay() ...

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    54

    Post How to use delay() in another function?

    Im using C with header file dos.h where delay() function works correctly in main function but when I use delay() in another function and calls it, it corrupts whole program. the program refreshes continously. how I use delay() in another function?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,687
    > but when I use delay() in another function and calls it, it corrupts whole program.
    What does this mean?
    Post some code which shows the problem you're facing.

    But if your compiler is TurboC, and your OS is something like Windows XP or newer, then the only advice you need is to upgrade your compiler.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    54
    bro Im using Turbo C++ 3.0 in windows xp

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,687
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    6,454
    Quote Originally Posted by shansajid View Post
    Im using C with header file dos.h where delay() function works correctly in main function but when I use delay() in another function and calls it, it corrupts whole program. the program refreshes continously. how I use delay() in another function?
    Not withstanding the concern of your using an obsolete compiler, the delay() function shipped with Turbo C++ is not something that "corrupts whole program".

    There are two likely explanations. The first is that you have implemented a function named delay() which is doing something it shouldn't. The other possible explanation is that some other unrelated code in your program is doing something untoward, such as writing to an area of memory it shouldn't.

    Either way, without a small sample of representative code (i.e. code that compiles, links, and exhibits the unwanted symptoms when run) nobody can help you. If your program is large, do some work to create a small code sample that exhibits your problem.
    shansajid likes this.
    Right 98% of the time, and don't care about the other 3%.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. generic delay() function
    By moonlord in forum C Programming
    Replies: 8
    Last Post: 08-10-2005, 02:27 AM
  2. Is there a delay function?
    By Digga in forum Windows Programming
    Replies: 2
    Last Post: 05-06-2005, 10:56 AM
  3. Delay function
    By knight543 in forum C++ Programming
    Replies: 4
    Last Post: 01-14-2002, 02:04 PM
  4. Use a delay function
    By Robert_Ingleby in forum C++ Programming
    Replies: 2
    Last Post: 11-23-2001, 05:58 AM
  5. time delay function available?
    By cUser in forum C Programming
    Replies: 3
    Last Post: 10-01-2001, 12:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21