-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
33 lines (26 loc) · 861 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <iostream>
#include <fstream> // ofstream
#include <unistd.h> // usleep
using namespace std;
#define USEC 1000000 // micro second to second multiplier
#define WAKEOUT "wake" // default wake output; will be changeable in the future
int main(int argc, char* argv[]) {
int stimer = 5*USEC; // set default timer to 5 seconds
ofstream wakeFiles[argc];
cout << "wake on...\n";
while(true){
for (int i = 1; i < argc; i++)
{
wakeFiles[i].open(argv[i]); // open wake file
}
for (int i = 1; i < argc; i++)
{
wakeFiles[i] << WAKEOUT; // write default wake out to wake file
}
for (int i = 1; i < argc; i++)
{
wakeFiles[i].close(); // close wake file
}
usleep(stimer); // wait stimer seconds
}
}