Results 1 to 3 of 3

Thread: delay function not working in c

  1. #1
    Member
    Join Date
    Jun 2011
    Location
    India
    Posts
    42
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default delay function not working in c

    Hello all i have created a simple program in c but delay function is not working
    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    #include<io.h>
    #include<time.h>
    #include<stdlib.h>
    int length(char *s)
    {
    int a;
    a = strlen(s);
    return a;
    }
    int main()
    {
    char name[50];
    printf("Enter your name = ");
    scanf("&#37;s",name);
    printf("\nPlease wait computer is determining the length of your name");
    delay(1000);
    printf("Your name has %d digits",length(name));
    getch();
    return 0;
    }
    Last edited by rinkujames; 18th March 2012 at 08:27 PM.

  2. #2
    Junior Member
    Join Date
    Mar 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    "delay(10000);" is wait for 10 secs only, so dont run and go for break otherwise you will not get that it is working.
    If really not working then use sleep(10000) with time.h includes.


    Quote Originally Posted by rinkujames View Post
    Hello all i have created a simple program in c but delay function is not working

    Code:-

    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    #include<io.h>
    #include<time.h>
    #include<stdlib.h>
    int length(char *s)
    {
    int a;
    a = strlen(s);
    return a;
    }
    int main()
    {
    char name[50];
    printf("Enter your name = ");
    scanf("&#37;s",name);
    printf("\nPlease wait computer is determining the length of your name");
    delay(10000);
    printf("Your name has &#37;d digits",length(name));
    getch();
    return 0;
    }



    compile time msg :- "0 error 1 warning impilicit declaration of delay function"

    please help

  3. #3
    Member
    Join Date
    Jun 2011
    Location
    India
    Posts
    42
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    Quote Originally Posted by bimlesh View Post
    "delay(10000);" is wait for 10 secs only, so dont run and go for break otherwise you will not get that it is working.
    If really not working then use sleep(10000) with time.h includes.
    I have solved this problem, the main problem was the usage of correct header file.

    Hello friend first of all there is no standard function "delay" and "sleep" in c language , neither in C89/90 nor in C99 standard,these function provided by additional header file .

    In Windows = dos.h provide sleep and delay function .

    In Linux or Unix = unistd.h header file provide sleep function

    sleep function is not defined in time.h header file see online documentation or "man time.h"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. squid configuration with delay pools
    By chandanperl in forum Getting started tutorials
    Replies: 14
    Last Post: 14th November 2011, 07:23 PM
  2. Squid and Delay Pools Tutorial
    By squdder in forum Proxy Servers
    Replies: 0
    Last Post: 22nd June 2011, 03:38 PM
  3. Squid and Delay Pools
    By squdder in forum Linux software
    Replies: 0
    Last Post: 22nd June 2011, 03:38 PM
  4. Call Function Within Function [PHP]
    By eawedat in forum Coding in General
    Replies: 1
    Last Post: 4th June 2010, 09:08 PM
  5. Fixing bandwidth with delay pool
    By usmanmaniskp in forum Proxy Servers
    Replies: 0
    Last Post: 20th December 2008, 06:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •