Newer
Older
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
34
35
36
37
38
#include "serialListReader.h"
#include "QtCore/QCoreApplication"
#include <vector>
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
if (argc != 3) {
cerr << "Too few or too many parameters!" << endl;
return 1;
}
QCoreApplication *_app = new QCoreApplication(argc,argv);
serialListReader *_reader = new serialListReader(false);
vector<string> serialListString = _reader->getFullList();
vector<unsigned int> serialList;
serialList.clear();
for ( size_t i = 0 ; i < serialListString.size() ; i++) serialList.push_back( stoul( serialListString[i] ) );
if ( serialListString.size() != serialList.size() ) {
cerr << "ERROR: Sizes don't match!" << endl;
return 1;
}
unsigned int serialMin = stoul(argv[1]);
unsigned int serialMax = stoul(argv[2]);
int numOut = 0;
for ( size_t i = 0 ; i < serialList.size() ; i++) {
if ( serialList [i] >= serialMin && serialList [i] <= serialMax ) {
cout << serialListString[i] << endl;
numOut++;
}
}
cerr << "Found " << numOut << " APDs in the given range." << endl;
return 0;
}