I'm doing a program in which I need 2 options, one to insert at the beginning and another to insert at the end, I know how to insert it at the end which is adding the "app" flag and the cursor will be written at the end of the file, my question is with which flag can I put the cursor to the beginning of the file so that it writes at the beginning?.
I've already searched many websites but I can not find it.
The code I am using is the following:
ofstream fout(ruta, ios::app);
if(!fout.good()){
cout<<"Error al arbir el archivo txt"<<endl;
}
fout.write((char*)&objA, sizeof (A));
fout.close();