file.open(input_file);
char z;
while(file.get(z))
{
str1 = str1 + z;
pos1++;
}
file.close();
fout.open(output_file , ios :: app);
file.seekg(0,ios::beg) ;
fout<<endl;
fout<<str1;
fout.close();
file.open(output_file);
file.seekg(0,ios::beg);
char y;
while(file.get(y))
{
cout<<y;
}
file.close();
cout<<endl;
In the above code, I have used seekg
and std::ios::app
function but it adds the input text file at the end of output text file. How do I add it at the beginning?