From 7c4ed8453ceb90653c9260d23d03caa9fbffb5e1 Mon Sep 17 00:00:00 2001 From: Alex Schmidt Date: Sun, 13 Oct 2013 13:50:31 +0200 Subject: [PATCH] fixed comargs. --- stickletrack.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/stickletrack.cpp b/stickletrack.cpp index 85deb6d..c5957d4 100755 --- a/stickletrack.cpp +++ b/stickletrack.cpp @@ -520,7 +520,7 @@ void showUsage() { cout << "-b " << "\t" << "buffer seconds for going back in time" << endl; } -bool parseComArgs (int ac, char** av) { +bool parseComArgs (int ac, char* av[]) { if ( ac < 2 || ac%2 ) { showUsage(); exit(0); @@ -531,24 +531,23 @@ bool parseComArgs (int ac, char** av) { comArgs.maxOutputFPS = 25; comArgs.backBufferSize = 10; - for (int i = 1; i < ac-1; i++) - if (i + 1 != ac) - if (av[i] == "-x") { - comArgs.rescalingFactor = atof(av[i + 1]); - } else if (av[i] == "-o") { - comArgs.maxOutputFPS = atoi(av[i + 1]); - } else if (av[i] == "-b") { - comArgs.backBufferSize = atoi(av[i + 1]); - } else { - cout << "Unknown command line parameters!\n"; - showUsage(); - exit(0); - } + for (int i = 1; i < ac-2; i = i+2) + if ( strcmp(av[i], "-x") == 0 ) { + comArgs.rescalingFactor = atof(av[i + 1]); + } else if ( strcmp(av[i], "-o") == 0 ) { + comArgs.maxOutputFPS = atoi(av[i + 1]); + } else if ( strcmp(av[i], "-b") == 0 ) { + comArgs.backBufferSize = atoi(av[i + 1]); + } else { + cout << "Unknown command line parameters!\n"; + showUsage(); + exit(0); + } comArgs.videoFileName = av[ac-1]; } -int main(int ac, char** av) { +int main(int ac, char* av[]) { parseComArgs(ac, av); capture.open( comArgs.videoFileName ); -- 2.39.5