| Version 3 (modified by , 15 years ago) ( diff ) |
|---|
Table of Contents
CSleep
CSleep is a C++ class for sleep functions
Constructor
CSleep(int nSeconds, int nMilliseconds);
Parameters
- nSeconds - Number of seconds to sleep when 'Pause' member function is called
- nMilliseconds - Number of milliseconds to sleep when 'Pause' member function is called
Example
CSleep slp(0, 50);
int n;
for(n = 0; n < 10; n++)
{
printf("Item %d\r\n", n);
slp.Pause(); // This will create a 50 millisecond delay between each iteration in the loop
}
Member Functions
SetTime
Sets the pause time
void SetTime(int nSeconds, int nMilliseconds);
Parameters
- nSeconds - Number of seconds to sleep when 'Pause' member function is called
- nMilliseconds - Number of milliseconds to sleep when 'Pause' member function is called
Return Value
Function does not return a value.
Remarks
Example
CSleep slp(0, 50);
int n;
for(n = 0; n < 10; n++)
{
printf("Item %d\r\n", n);
slp.Pause(); // This will create a 50 millisecond delay between each iteration in the loop
}
// Now we might want to reuse the same object with a different delay
slp.SetTime(0, 100);
for(n = 0; n < 10; n++)
{
printf("Item %d\r\n", n);
slp.Pause(); // This will create a 100 millisecond delay between each iteration in the loop
}
Pause
Pauses the amount of time specified by the constructor or SetTime
void Pause(void);
Parameters
Function does not accept any parameters
Retrun Value
Function does not return any result.
Remarks
Example
CSleep slp(0, 50);
int n;
for(n = 0; n < 10; n++)
{
printf("Item %d\r\n", n);
slp.Pause(); // This will create a 50 millisecond delay between each iteration in the loop
}
Note:
See TracWiki
for help on using the wiki.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/cardinal.gif)