Create n outut files

Hi,
I have a 10k events data file and I would like to create 10 output files to store the mean signal calculated over 1000 waveforms.
I am trying with

   char out_name[10];

   for(i=0; i<10;i++){
      sprintf(out_name, "WF_%d.dat", i);
      ofstream file1= (out_name);
   }

but this is not working!
the error I get is:

error: no viable conversion from 'char [10]' to 'std::__1::ofstream' (aka
      'basic_ofstream<char>')

can anybody help me with that?

With ROOT you can use Form

   for (i=0; i<10;i++) {
      ofstream file1= (Form("WF_%d.dat", i));
   }

std::ofstream file1(out_name);

I tried but I had a similar error:
/Users/hull/Lavoro/PowderO/Data_WC/ZWO/WF_100.C:273:15: error: no viable conversion from ‘char *’ to 'std::_1::ofstream’ (aka
‘basic_ofstream’)
ofstream file1=(Form("WF
%d.dat",i));
^ ~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/bin/…/include/c++/v1/iosfwd:146:32: note: candidate constructor (the implicit copy constructor) not viable: no known
conversion from ‘char *’ to ‘const std::__1::basic_ofstream<char,
std::__1::char_traits > &’ for 1st argument
class _LIBCPP_TEMPLATE_VIS basic_ofstream;
^
/Library/Developer/CommandLineTools/usr/bin/…/include/c++/v1/fstream:1374:5: note: candidate constructor not viable: no known conversion from ‘char *’ to
‘std::__1::basic_ofstream<char, std::__1::char_traits > &&’ for 1st
argument
basic_ofstream(basic_ofstream&& __rhs);
^
root [1]

this is working thanx a lot!