portability of a pause function

This is a discussion on portability of a pause function within the C Programming forums, part of the General Programming Boards category; Hi everyone. I am using a pause function in a homework program and was wondering what the portability limitations would ...

  1. #1
    Registered User Eigenvalue's Avatar
    Join Date
    Aug 2002
    Posts
    21

    portability of a pause function

    Hi everyone. I am using a pause function in a homework program and was wondering what the portability limitations would be (i.e. can it be used on other OS). The compiler I am using is MSVC++ v.6.0. and the function is
    Code:
    void pausing(int seconds) 
    {
      clock_t endtime = clock() + seconds * CLOCKS_PER_SEC;
      while ( ( clock() < endtime ) );
    }
    Thanks,
    Eigenvalue

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    That is actually a good example of portability. So yes.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #3
    Registered User Eigenvalue's Avatar
    Join Date
    Aug 2002
    Posts
    21
    Thank you for the replies.
    The program I have coded is the classic tortoise vs. hare simulation, and the pause is being used to give the user the time to see the race as it is run. vVv, could you elaborate on your answer? I like to learn all of the nitty gritty of things.

    Sincerely,
    Eigenvalue

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 09:28 AM
  2. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 09:18 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 01:03 PM
  4. Replies: 5
    Last Post: 02-08-2003, 07:42 PM
  5. Pause function ???
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 09-02-2001, 09:22 PM

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