17{
18 std::ifstream dict;
20 dict.open((WApplication::appRoot() + "dict-nl.txt").c_str());
21 } else {
22 dict.open((WApplication::appRoot() + "dict.txt").c_str());
23 }
24
25 std::string retval;
26 int numwords = 0;
27 while(dict) {
28 getline(dict, retval);
29 numwords++;
30 }
31 dict.clear();
32 dict.seekg(0);
33
34 srand(time(0));
35 int selection = rand() % numwords;
36
37 while(selection--) {
38 getline(dict, retval);
39 }
40 getline(dict, retval);
41 for(unsigned int i = 0; i < retval.size(); ++i)
42 if(retval[i] < 'A' || retval[i] > 'Z')
43 std::cout << "word " << retval
44 << " contains illegal data at pos " << i << std::endl;
45
46 return widen(retval);
47}