- static const size_t nThreads = 3;
- MyThread *threads[nThreads];
- size_t n;
- for ( n = 0; n < nThreads; n++ )
- {
- threads[n] = new MyThread('+' + n);
- threads[n]->Run();
- }
+ case 0:
+ // everything is ok; proceed
+ if (parser.Found("d"))
+ {
+ wxPrintf("Dummy switch was given...\n");
+
+ while (1)
+ {
+ wxChar input[128];
+ wxPrintf("Try to guess the magic number (type 'quit' to escape): ");
+ if ( !wxFgets(input, WXSIZEOF(input), stdin) )
+ break;
+
+ // kill the last '\n'
+ input[wxStrlen(input) - 1] = 0;
+
+ if (wxStrcmp(input, "quit") == 0)
+ break;
+
+ long val;
+ if (!wxString(input).ToLong(&val))
+ {
+ wxPrintf("Invalid number...\n");
+ continue;
+ }
+
+ if (val == 42)
+ wxPrintf("You guessed!\n");
+ else
+ wxPrintf("Bad luck!\n");
+ }
+ }
+ break;