The argument of
system
is a string, you may generate such a string according to your needs.
For instance the following program
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main()
{
vector <const char *> names { "foo.txt", "boo.txt", "gooooo.txt" };
for (const auto & name : names )
{
ostringstream oss;
oss << "hciconfig -a > " << name;
cout << oss.str() << endl; }
}
produces
hciconfig -a > foo.txt
hciconfig -a > boo.txt
hciconfig -a > gooooo.txt