Attachment 'realtime.cc'
Download 1 #include <iostream>
2 #include <fstream>
3 #include <sstream>
4 #include <cstring>
5
6 int main(int argc, char *argv[])
7 {
8 char b[32];
9 char p[] = { 'r', 'e', 'a', 'l', '\t' };
10
11 for (int i = 1; i < argc; ++i) {
12 std::ifstream f(argv[i]);
13 while (!(f.getline(b, sizeof(b)).eof() || f.bad())) {
14 if (f.fail()) {
15 f.clear();
16 f.ignore(4096, '\n');
17 }
18 if (std::memcmp(b, p, sizeof(p))) continue;
19
20 int min, sec, msec;
21 char filler;
22 std::istringstream s(b + 5);
23 s >> min >> filler >> sec >> filler >> msec;
24 std::cout << min * 60000 + sec * 1000 + msec << std::endl;
25 }
26 f.close();
27 }
28 }
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.