i'm trying to replace line in file.
Example
aaa bbb ccc
bbb ccc ddd
ccc ddd eee
I want to replace second line with something like
111 222 333
so result will be
aaa bbb ccc
111 222 333
ccc ddd eee
I tried
while (getline(infile, curline))
{
    if (counter == line)
    {
        outfile << input1 << "\t" << input2 << "\t" << input3 << "\t" << input4 << endl;
        break;
    }
    counter++;
}
where line is number of line i want to replace.
Thanks for help!
 
    