| | 6 | == Constructor == |
| | 7 | |
| | 8 | {{{ |
| | 9 | CSleep(int nSeconds, int nMilliseconds); |
| | 10 | }}} |
| | 11 | |
| | 12 | ==== Parameters ==== |
| | 13 | * nSeconds - Number of seconds to sleep when 'Pause' member function is called |
| | 14 | * nMilliseconds - Number of milliseconds to sleep when 'Pause' member function is called |
| | 15 | |
| | 16 | ==== Example ==== |
| | 17 | |
| | 18 | {{{ |
| | 19 | CSleep slp(0, 50); |
| | 20 | |
| | 21 | int n; |
| | 22 | for(n = 0; n < 10; n++) |
| | 23 | { |
| | 24 | printf("Item %d\r\n", n); |
| | 25 | slp.Pause(); // This will create a 50 millisecond delay between each iteration in the loop |
| | 26 | } |
| | 27 | }}} |
| | 28 | |
| | 29 | == Member Functions == |
| | 30 | |
| | 31 | === SetTime === |
| | 32 | Sets the pause time |
| | 33 | |
| | 34 | {{{ |
| | 35 | void SetTime(int nSeconds, int nMilliseconds); |
| | 36 | }}} |
| | 37 | |
| | 38 | ==== Parameters ==== |
| | 39 | * nSeconds - Number of seconds to sleep when 'Pause' member function is called |
| | 40 | * nMilliseconds - Number of milliseconds to sleep when 'Pause' member function is called |
| | 41 | |
| | 42 | ==== Return Value ==== |
| | 43 | |
| | 44 | Function does not return a value. |
| | 45 | |
| | 46 | ==== Remarks ==== |
| | 47 | |
| | 48 | ==== Example ==== |
| | 49 | |
| | 50 | {{{ |
| | 51 | CSleep slp(0, 50); |
| | 52 | |
| | 53 | int n; |
| | 54 | for(n = 0; n < 10; n++) |
| | 55 | { |
| | 56 | printf("Item %d\r\n", n); |
| | 57 | slp.Pause(); // This will create a 50 millisecond delay between each iteration in the loop |
| | 58 | } |
| | 59 | |
| | 60 | // Now we might want to reuse the same object with a different delay |
| | 61 | slp.SetTime(0, 100); |
| | 62 | for(n = 0; n < 10; n++) |
| | 63 | { |
| | 64 | printf("Item %d\r\n", n); |
| | 65 | slp.Pause(); // This will create a 100 millisecond delay between each iteration in the loop |
| | 66 | } |
| | 67 | |
| | 68 | }}} |
| | 69 | |
| | 70 | === Pause === |
| | 71 | Pauses the amount of time specified by the constructor or SetTime |
| | 72 | {{{ |
| | 73 | void Pause(void); |
| | 74 | }}} |
| | 75 | |
| | 76 | ==== Parameters ==== |
| | 77 | |
| | 78 | Function does not accept any parameters |
| | 79 | |
| | 80 | ==== Retrun Value ==== |
| | 81 | |
| | 82 | Function does not return any result. |
| | 83 | |
| | 84 | ==== Remarks ==== |
| | 85 | |
| | 86 | |
| | 87 | ==== Example ==== |
| | 88 | |
| | 89 | {{{ |
| | 90 | CSleep slp(0, 50); |
| | 91 | |
| | 92 | int n; |
| | 93 | for(n = 0; n < 10; n++) |
| | 94 | { |
| | 95 | printf("Item %d\r\n", n); |
| | 96 | slp.Pause(); // This will create a 50 millisecond delay between each iteration in the loop |
| | 97 | } |
| | 98 | }}} |
| | 99 | |