Results 1 to 3 of 3

Thread: write own sleep or delay function c++

  1. #1
    Administrator asylu3's Avatar
    Join Date
    Jun 2000
    Location
    Thailand
    Posts
    3,557


    write own sleep or delay function c++

    [src]#include < time.h >
    #include < iostream.h >

    void sleep( clock_t wait )
    {
    clock_t goal;
    goal = wait + clock();
    while( goal > clock() );
    }

    void main()
    {
    sleep(5000);
    cout<<"hello";

    }
    [/src]
    Note: this code implemented in vc++ 6.0

  2. #2
    Administrator asylu3's Avatar
    Join Date
    Jun 2000
    Location
    Thailand
    Posts
    3,557


    Re: write own sleep or delay function c++

    This one would helpful also.

    [src]
    #include < iostream.h >
    #include < windows.h >
    void main()
    {

    cout<<"test";
    ::Sleep(1000);
    cout<<"test2";
    }
    [/src]

  3. #3
    Junior Member
    Join Date
    Dec 2006
    Posts
    0


    Re: write own sleep or delay function c++

    The ::Sleep() function in not a delay function for everything. It is only to suspend the execution of the current thread for a specified interval.
    In other words the time in this function is controlled by the current thread priority.

Similar Threads

  1. How To Write A Basic Keylogger In VB
    By Satyr1c in forum แนะความรู้ด้าน Programming ต่างๆ
    Replies: 0
    Last Post: 20-05-2009, 09:52 PM
  2. อยากเขียนโปรแกรมเพิ่ม delay ในการแสดงผล streaming media น่ะครับ
    By oocokeoo in forum แนะความรู้ด้าน Programming ต่างๆ
    Replies: 1
    Last Post: 26-03-2009, 09:05 AM
  3. Write your Own Packer!!!!
    By Tummy in forum Unpacker/Packer
    Replies: 0
    Last Post: 15-05-2008, 04:14 PM
  4. Write down your password?
    By newsbot in forum World Hacking/Security News
    Replies: 0
    Last Post: 18-12-2007, 10:10 PM
  5. จะ write FreeBSD4.7
    By RedAnalyzer in forum E-Book, Video หรือบทความทั่วไปด้าน Computer
    Replies: 1
    Last Post: 09-02-2003, 10:40 PM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Posting Permissions

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