hi ,
I have written a program , a part of which is below which generates output files with extension 1.dat , 2.dat n so on ... but i want output something like .. prog1.dat and prog2.dat .... so on .... can someone help me out with this how i can get output filenames like that:
while(!infile2.eof())
{
i++;
sin.str("");
infile1.clear();
infile1.seekg(0,ios::beg);
sin << i;
std::string val(sin.str());
cout<<"i: " <<val<<endl;
std::string val1;
val1 = val+".dat";
outfile.open(val1.c_str());
Comments
: I have written a program , a part of which is below which
: generates output files with extension 1.dat , 2.dat n so on ...
: but i want output something like .. prog1.dat and prog2.dat .... so
: on .... can someone help me out with this how i can get output
: filenames like that:
:
: while(!infile2.eof())
: {
: i++;
: sin.str("");
: infile1.clear();
: infile1.seekg(0,ios::beg);
: sin << i;
:
: std::string val(sin.str());
: cout<<"i: " <<val<<endl;
: std::string val1;
: [red] val1 = val+".dat";[/red]
: outfile.open(val1.c_str());
:
Change the red line above into:
[code]
val1 = "prog"+val+".dat"
[/code]