As far as I could see in your request, you search that when you run your program, add text, close the program and reopen it to show you what you have entered.
But in your code you do not read the content that stores the file, and if you do not do it you will not be able to read it.
I do not know much about the C language but I understand and I use C ++ very well, I know they are different things, but with a little research and based on my knowledge, I created a code, where I think that is what you seek to achieve. And I also think that if you do not understand the c ++ language with a little research in the files or files area you will be able to understand it.
Anyway I tried to comment the code in a comprehensible way so that you understand it.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char Texto[100];
char AgregarMasTexto;
ofstream Archivo_Escritura;
Archivo_Escritura.open("hola.txt", ios::out | ios::app);
if(Archivo_Escritura.is_open())
{
cout << "\tEscritura del archivo." << endl << endl << endl << endl;
cout << "Desea agregar texto a su archivo (S/N): ";
cin >> AgregarMasTexto;
while((AgregarMasTexto == 's') || (AgregarMasTexto == 'S'))
{
cout << endl << endl << endl << "Ingrese el texto que desee: ";
cin >> Texto;
Archivo_Escritura << Texto << endl;
cout << "Desea agregar mas texto(S/N): ";
cin >> AgregarMasTexto;
}
}
else
{
cout << "El archivo no fue creado correctamente." << endl;
}
ifstream Archivo_Lectura;
Archivo_Lectura.open("hola.txt", ios::in);
if(Archivo_Lectura.is_open())
{
cout << endl << endl << endl << endl << endl;
cout << "____________________________________________." << endl << endl;
cout << "\tLectura del archivo." << endl << endl << endl << endl;
Archivo_Lectura >> Texto;
cout << "El texto que existe en su archivo es el siguiente: "<<endl<<endl;
while(!Archivo_Lectura.eof())
{
cout << Texto << endl;
Archivo_Lectura >> Texto;
}
cout << "______________________________________________." << endl << endl;
}
else
{
cout << "El archivo no fue creado correctamente." << endl;
}
Archivo_Lectura.close();
Archivo_Escritura.close();
return 0;
}