<edit>(scroll down a bit to avoid some rambling and get to the main question!)</edit>
Hi there,
I'm trying to write a C++ program that repeatedly executes another program (with a system call) that creates a file called 'output', then copies the output into a subdirectory and renames it so that it isn't overwritten on the next iteration.
I'm using arrays of characters as per the example at www.cplusplus.com:

/* rename example */
#include <stdio.h>

int main ()
{
  int result;
  char oldname[] ="oldname.txt";
  char newname[] ="newname.txt";
  result= rename( oldname , newname );
  if ( result == 0 )
    puts ( "File successfully renamed" );
  else
    perror( "Error renaming file" );
  return 0;
}

Now, the DO loop in the program is governed by the next_permutation function, which generates all of the unique combinations of characters in a string, and the DO loop continues until there aren't any more permutations. On each interation, the next permutation is generated as an array, and I'd like to insert this into the new file name array so that a unique filename (for that program run) is created each time, but I don't know how to do this.

So in a nutshell, my question is, how do you insert one array into another?

Thanks!

never mind, I solved this by just incrementally replacing the elements of one thread with the other :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.