title: How do I concatenate a string and an integer to make a filename?
body: <p>I have a series of files ( New1.BMP, New2.BMP, ...,New10.BMP). </p>
  
  <p>I need to create a variable that stores the name of the above files and then use it in another code. </p>
  
  <p>My current code:</p>
  
  <pre><code>int LengthFiles =10;
  char FilePrefix[100]="New";//This is actually passed to the function. Am changing it here for simplicity
  char str[200],StrNumber[1];//str holds the file name in the end. StrNumber is used to convert number value to character
   SDL_Surface *DDBImage[9]; // This is a SDL (Simple DIrectMedia Library) declaration.
   for (int l=0;l&lt;LengthFiles ;l++)
       {      
      itoa(l, StrNumber, 1);
      strcat(str,FilePrefix);strcat(str,StrNumber);strcat(str,".BMP");
      DDBImage[l]= SDL_DisplayFormat(SDL_LoadBMP(str));
  
       }
  </code></pre>
  
  <p>As you might see, I have no clue how to code in C++, I have tried to make this work from code snippets online. Is this how it is supposed to work in C/C++, i.e. on the fly creation of variables.</p>
  
  <p>How do I best approach it?</p>