$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] commandline args
From: Shaolin (shaolinfinest_at_[hidden])
Date: 2009-08-23 13:31:51
Hi Guys
Below is my current code used to retrieve commandline arguments:
int i = 1;
while (i < argc)
{
if (strcmp(argv[i], "-f") == 0)
{
for (++i; i < argc && strcmp(argv[i], "-s") != 0; ++i) {
filearr.push_back(argv[i]);
}
}
else if (strcmp(argv[i], "-s") == 0)
{
for (++i; i < argc && strcmp(argv[i], "-f") != 0; ++i) {
searchtext = argv[i];
}
}
else
{
++i;
}
}
As you can see, its not very scalable. I am thinking of adding another
feature args but it'll become difficult to manage. Is there anything on
boost which does the same thing albeit with alot less code ?